The fourth practice

JavaScript programming problem

Enter a year (authentication required), it is determined whether the page is a leap year (year divisible by four, not be divisible by 100; divisible by 400 is a leap year), and displays the corresponding message on the page.

<! DOCTYPE HTML> 
<HTML> 
    <head> 
        <title> leap </ title> 
        <Meta charset = "UTF-. 8"> 
    </ head> 
    <body> 
        <form> 
            enter year: <INPUT ID = "year" = type "text" /> 
            <span ID = "Check"> </ span> 
        </ form> 
        <Script> var INPUT = document.getElementById ( "year" );
             var Tip = document.getElementById ( "Check" );
             // input box loses focus trigger event 
            input.onblur = function() {
                var year = input.value.trim();
                //
            Digit number by a 4 year 
                IF (/ ^ \ {D} $ 4 / .test (year)) {
                     // can not be divisible by 4 year divisible by 100; leap year is divisible by 400 
                    IF ((year% ! year. 4 == 0 && 0 = 100%) || (400% year == 0 )) { 
                        tip.innerHTML = "leap" ; 
                    } the else { 
                        tip.innerHTML = "non-leap" ; 
                    } 
                } the else { 
                    Tip. the innerHTML = "year format is not correctly re-enter" ; 
                } 
            }
         </ Script> 
    </ body> 
</ HTML>

 


MySQL quiz

How MySQL login prompt command? How to list all the databases? How to switch to a database and work on it? How to list all the tables in a database? How to get the name and type of all Field objects in the table?

1.    mysql -u -p  
2.    show databases;  
3.    use dbname; 
4.    show tables;  
5.    describe table_name ;

 


Java programming problem

If a number is exactly equal to the sum of its factors, this number is called a "complete count." For example 6=1+2+3Programming number to find all finished within 1000.

Package Test; 

/ ** 
 * Number End Analyzing 
 * @author the CUI
  * / 
public  class TL5 {
     / ** 
     * is determined whether the number of finished 
     * @param number a required determination 
     * @return Boolean
      * / 
    public  static  Boolean Test ( int a ) {
         int Cup = 0 ;
         // loop through, to find all of the factors, and calculating the sum factor 
        for ( int I =. 1; I <A; I ++ ) {
             IF (A% I == 0 ) 
                Cup = Cup + I;
        }
        return (cup == a);
    }

    public static void main(String[] args) {
        String str = "";
        for (int i = 1; i < 1000; i++) {
            if (test(i)) {
                str += i + ",";
            }
        }
        System.out.print(str.substring(0, str.length() - 1));
    }
}

 

Guess you like

Origin www.cnblogs.com/czh518518/p/11288083.html