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 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 <form. elements. length; 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: <SCRIPT type = "text/JavaScript" src = "AAA. js"> </SCRIPT>
50. Specify the HTML displayed in a browser that does not support scripts: <NoScript> </NoScript>
51.when there are both hyperchains and onclickrelated items, the old browser turns to a.html and the old browser turns to B .html.
Example: <a href00000000a.html "onclick00000000location.href0000' B .html '; return false"> dfsadf </a>
52. js built-in objects include:
Array, Boolean, date, error, evalerror,
Function, math, number, object, rangeerror, referenceerror,
Regexp, String, syntaxerror, typeerror, urierror
Line feed in 53. JS: \ n
54. Full Screen Window Size:
<SCRIPT> function fullscreen () {This. moveTo (0, 0); this. outerwidth = screen. availwidth;
This. outerheight = screen. availheight;} window. Maximize = fullscreen; </SCRIPT>
All in 55. js represents all the elements in its lower layer.
56. js focus sequence: Document. getelementbyid ("form element"). tabindex = 1
57. The value of innerhtml is the value of the form element:
For example, if <p id = "para"> "How are <em> You </em>" </P>, the value of innerhtml is: how are <em> You </em>
58. The value of innertext is the same as the above, but the <em> mark is not displayed.
59. contenteditable: You can set whether the element can be modified. iscontenteditable returns whether the element can be modified.
60. isdisabled determines whether it is in the forbidden state. Disabled sets the forbidden state.
61. length gets the length and returns an integer value.
62. addbehavior () is an external function file called by JS. Its extension is. HTC.
63. Window. Focus () before all windows.
64. Blur () indicates losing focus. Opposite to focus.
65. Select () indicates that the element is selected.
66. Prevent users from entering text in the text box:
Onfocus = "This. Blur ()"
67. Retrieve the number of elements displayed on the page:
Document. All. Tags ("Div (or other HTML tags)"). Length
There are two forms of output in 68. JS: modal and non-modal.
Window. showmodaldialog (), window. showmodeless ()
69. Setting of the status bar text:
Window. Status = 'text', default status bar text settings: window. defaultstatus = 'text .';
70. Add to favorites:
External. AddFavorite ("http://meil.cnblogs.com";, "jaskdlf ");
71. js does not perform any operations when a script error occurs:
Window. onerror = donothing; syntax for specifying the error handle: window. onerror = handleerror;
72. js specifies the parent window that is currently open:
Window. opener, supporting opener. Opener... .
73. Self in. js refers to the current window.
74. js status bar display content: window. Status = "content"
75. Top in JS refers to the top-level framework in the framework set.
76. Close the current window in JS: window. Close ();
If (confirm ("Are you sure ?")) {Alert ("OK");} else {alert ("not OK ");}
Window redirection in 78. JS: window. navigate ("http://meil.cnblogs.com ";);
79. js print: window. Print ()
Window. Prompt ("message", "defaultreply ");
Window scroll bar in 81. JS: window. Scroll (x, y)
82. JS: window. scrollby
Set the interval in 83. JS: setinterval ("expr", msecdelay), setinterval (funcref, msecdelay), or setTimeout
The Mode in 84. JS is displayed in ie4, but not in NN: showmodaldialog ("url" [, arguments] [, features]);
Handle used before exit in 85. JS:
Function verifyclose () {event. returnvalue = "we really like you and hope you will stay longer." ;}} window. = verifyclose;
86. file handle used when the form is called for the first time: onload ()
87. file handle called when the form is closed: onUnload ()
88. Properties of window. Location:
Protocol (HTTP :), hostname (www.example.com), Port (80), host (www.example.com: 80 ),
Pathname ("/A/a.html"), hash ("# giantgizmo", refers to jump to the corresponding anchor), href (all information)
89. Window. Location. Reload () refresh the current page.
90. Window. History. Back () returns the previous page, window. History. Forward () returns the next page,
Window. History. Go (return the page number, or use the accessed URL)
91.doc ument. Write () output without line feed, document. writeln () line feed output
92.doc ument. Body. nowrap = true; prevents link text from being broken.
93. variable name. charat (nth digit), which is the nth character of the variable.
94. "ABC". charcodeat (NTH), returns the ASCII value of the nth character.
95. String connection: String. Concat (string2), or use = to connect
96. Variable. indexof ("character", starting position), returns the first occurrence location (starts from 0)
97. String. lastindexof (searchstring [, startindex.
98. String. Match (regexpression) to determine whether the character matches.
99. String. Replace (regexpression, replacestring) to replace the existing string.
100. String. Split (separator) returns an array storage value.
101. String. substr (start [, length]) takes the string from the nth digit to the specified length.
102. String. tolowercase () converts all strings to lowercase.
103. String. touppercase () converts all characters to uppercase.
104. parseint (string [, Radix (representing hexadecimal)]) is forcibly converted to an integer.
105. parsefloat (string [, Radix]) is forcibly converted to floating point type.
106. isnan (variable): test whether it is Numeric.
107. Key words defining constants: const; key words defining variables: VaR
From: http://www.apkbus.com/blog-112160-43966.html