JavaScript programming problem
In accordance with the following requirements, a menu written in JavaScript linkage year, month, and day.
1, the default display the current date; 2, select years before they can select the month, select the month before they can choose the date and the number of days in February to be correct;
<html> <head> <meta charset="UTF-8"> <title>年月日下拉框联动</title> </head> <body> <form name="dateInfo"> <select name="yearName" onchange="testYear(this.value)"> <option value="">请选择年</option> </select> <select name="monthName" onchange="testMonth(this.value)"> <option value="">请选择月</option> </select> <select name="dayName"> <option value="">Please select the day </ the Option> vardefine the number of days each month// <Script> </ form> </ the SELECT> = monthTemp [31 is, 28, 31 is, 30, 31 is, 30, 31 is, 31 is, 30, 31 is, 30, 31 is ]; / * * * page finishes loading completes execution * / the window.onload = function () { // get the current year var yearValue = new new a Date () getFullYear ();. // get the current month var for monthValue = new new a Date () getMonth () + 1. ; // to prevail this year, the first 30 years, 30 years for ( var I = (yearValue - 30); I <= (30 + yearValue); I ++ ) { document.dateInfo.yearName.options.add (new new Option-( "" + + I "in" , I)); } // month drop down box for ( var I =. 1; I <= 12 is; I ++ ) { document.dateInfo.monthName.options.add ( new new Option- ( "" + i + "month" , i)); } // set the year document.dateInfo.yearName.value = yearValue; // set the month document.dateInfo.monthName.value = for monthValue; // get the current month number of days var dayValue = monthTemp [for monthValue -. 1 ]; // initialize block 2012 options initDay (dayValue, for monthValue, yearValue); // set the current date document.dateInfo.dayName.value = new new a Date () getDate ();. } // change when the date of change in function testYear (yearValue) { // Get current month var for monthValue = document.dateInfo.monthName.value; // determine whether the month is selected, if not checked, reset the date the option box iF (for monthValue == "" ) { optionsClear (document.dateInfo.dayName); return ; } // Get the number of days for the month var= monthTemp dayValue [for monthValue -. 1 ]; // initialize day option box initDay (dayValue, for monthValue, yearValue); } // when the date changes month linkage function testMonth (for monthValue) { // get the current year var yearValue = document.dateInfo .yearName.value; // determine whether the year is selected, if not checked, reset the date the option box iF (yearValue == "" ) { optionsClear (document.dateInfo.dayName); return ; } // get the number of days for the month var dayValue = monthTemp [for monthValue -. 1 ]; // Initialization day option box initDay (dayValue, for monthValue, yearValue); } // initialize day option box function initDay (dayValue, for monthValue, yearValue) { // determines whether February, and determines whether or not a leap year IF (for monthValue == && 2 isLeapYear (yearValue)) { dayValue ++ ; } // Get current date dropdown box var E = document.dateInfo.dayName; // reset the drop-down box optionsClear (E); // fill date dropdown box for ( var I . 1 =; I <= dayValue; I ++ ) { e.options.add ( new new Option-( "" + I + "Day" , I)); } } // determines whether the leap-average function isLeapYear (year) { // definition of a leap year (divisible by four), and ( (not divisible by 100) or (400 may be divisible)) Year return (% year. 4 == 0 && (year = 100% 400% 0 == 0 || year! )); } // reset dropdown function optionsClear (E) { e.options.length =. 1 ; } </ Script> </ body> </ HTML>
MySQL short answer
There are several common constraints What? What does it all mean? how to use?
Common constraints have a primary key, foreign key constraints, unique constraints, default constraint. 1, the primary key: PRIMARY KEY (primary key field) guarantee entity integrity, a table with only one primary key, but a primary key may include a plurality of fields, primary key field can not be empty; 2, the only: UNIQUE (constraint fields) to ensure that the entity complete resistance, a table has a plurality of unique constraints, can have a unique constraint comprise a plurality of fields; 3, foreign keys: fOREIGN kEY (foreign key fields), to ensure referential integrity, a table can have multiple foreign keys; 4, default value: dEFAULT (expression or NULL default value) to ensure the integrity of the domain, a table can have more than one default value constraints, but a field only a default value.
Java short answer
Array (Array) and list (ArrayList) What is the difference? When should you use Array instead of ArrayList?
1, comparing the contents of storage:
Array array can contain primitive types and object types,
ArrayList can only contain the object type.
Array array storage time must be the same type of element. ArrayList might not be.2, space comparison:
space Array array is fixed, it is necessary to determine the appropriate space in advance.
ArrayList is dynamic and growing space, and that space every time you add a new element of internal array will check whether enough time.3. Comparison of methods:
the ArrayList method is more diverse than Array, such as adding all addAll (), delete all removeAll (), returns an iterator iterator () and so on.Applicable scene:
If you want to save some of the present and will be unchanged during the entire program operating data, we can put them in a global array, but if we simply just want to save data in the form of an array without data increases and other operations, but help us to find it, then we choose ArrayList.
If we need to elements frequently moved or deleted, or is dealing with ultra large amounts of data, then use ArrayList really not a good choice because of its low efficiency, the use of an array of such an operation is very trouble, then we may consider selecting LinkedList.