1.doc ument. write (& quot;); Output Statement 2. the comments in JS are // 3. the traditional HTML document sequence is: document-& gt; html-& gt; (head, body) 4. the DOM sequence in a browser window is window-& gt; (navigator, screen, history, location, do
1.doc ument. write (""); Output statement
2. Comments in JS are //
3. The traditional HTML document sequence is:
Document-> html-> (head, body)
4. the DOM sequence in a browser window is:
Window-> (navigator, screen, history, location, document)
5. Get the name and value of the element in the form:
Document. getElementById ("ID of the element in the form"). name (or value)
6. JavaScript code in lowercase to uppercase:
Document. getElementById ("output"). value = document. getElementById ("input"). value. toUpperCase ();
7. value types in JS:
String, Number, Boolean, Null, Object, Function
8. Convert the numeric type in JS to the numeric type:
ParseInt (), parseFloat ()
9. convert numbers in JS to numeric:
("" Variable)
The string length in 10. JS is:
(Length)
11. The character and character in JS are connected with the use number.
12. Comparison operators in JS include:
= Equals ,! = Not equal to,>, >=, <. <=
13. declare variable usage in JS:
Var to declare
14. JS judgment statement structure:
If (condition) {} else {}
15. JS loop structure:
For ([initial expression]; [condition]; [upadte expression]) {inside loop}
16. The command for loop abort is:
Break
17. function definitions in JS:
Function functionName ([parameter],...) {statement [s]}
18. When multiple form forms appear in the file, you can use document. forms [0], document. forms [1] instead.
19. window:
Open window. open (), close a window: window. close (), the window itself: self
20. Set the status bar:
Window. status = "character ";
21. The prompt message is displayed:
Window. alert ("character ");
22. The pop-up confirmation box is as follows:
Window. confirm ();
23. A prompt box is displayed:
Window. prompt ();
24. Specify the position of the currently displayed link:
Window. location. href = "URL"
25. Retrieve the number of all forms in the form:
Document. forms. length
26. Close the output stream of the document:
Document. close ();
27. String append connector: =
28. Create a document element:
Document. createElement (), document. createTextNode ()
29. method for getting elements:
Document. getElementById ()
30. Set the value of all text members in the form to NULL:
Var form = terraform Doc ument. forms [0]
For (var I = 0; I
If (form. elements. type = "text "){
Form. elements. value = "";
}
}
31. Check whether the check button is selected in JS:
Document. forms [0]. checkThis. checked
(The checked attribute indicates whether to return TRUE or FALSE if selected)
32. Single-choice button group (the names of Single-choice buttons must be the same ):
Document. forms [0]. groupName. length
33. The single-choice button group also uses checked to determine whether it is selected.
34. Value of the drop-down list box:
Document. forms [0]. selectName. options [n]. value
(N sometimes adds. selectedIndex to the name of the drop-down list box to determine the selected value)
35. String definition:
Var myString = new String ("This is lightsword ");
36. Convert string to uppercase:
String. toUpperCase (); string to lowercase: string. toLowerCase ();
37. Return the position where string 2 appears in string 1:
String1.indexOf ("String2 ")! =-1 indicates no.
38. Take a character at the specified position in the string:
StringA. charAt (9 );
39. Retrieve the substring that specifies the start and end points in the string:
StringA. substring (2, 6 );
40. mathematical functions:
Math. PI (returns the circumference rate), Math. SQRT2 (returns the square), and Math. max (value1, value2) return
At most, Math. pow (value1, 10) returns the 10th power of value1, Math. round (value1) Rounding function,
Math. floor (Math. random () * (n 1) returns a random number.
41. Define date variables:
Var today = new Date ();
42. Date function list:
DateObj. getTime () Get the time, dateObj. getYear () Get the year, dateObj. getFullYear () Get the four-digit year,
DateObj. getMonth () Get the month, dateObj. getDate () Get the day, dateObj. getDay () Get the date,
The hour for dateObj. getHours (), the hour for dateObj. getMinutes (), and the second for dateObj. getSeconds,
DateObj. setTime (value) sets the time, dateObj. setYear (val) sets the year,
DateObj. setMonth (val) set month, dateObj. setDate (val) set day,
DateObj. setDay (val) indicates the day of the week, dateObj. setHours indicates the hour, and dateObj. setMinutes (val) indicates the minute,
DateObj. setSeconds (val) sets the second. [Note: this date and time start from 0]
43. FRAME representation:
[Window.] frames [n]. ObjFuncVarName, frames ["frameName"]. ObjFuncVarName, frameName. ObjFuncVarName
44. parent indicates the parent object, and top indicates the top object.
45. Open the parent window of the Child Window: opener
46. indicates the current location: this
47. When calling JS functions in a hyperlink, use: (javascript to start with followed by the function name
48. Do not execute this JS in the old browser:
49. Reference a file-Type JS: