1.document.write(""); output statement
2. The comment in JS is //
3. The traditional HTML document order is: document->html->(head,body)
4. The DOM order 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 number of the element in the form").name(or value)
6. A lowercase to uppercase JS: document.getElementById("output").value = document.getElementById("input").value.toUpperCase();
7. Value types in JS: String, Number, Boolean, Null, Object, Function
8. Convert character types in JS to numerical types: parseInt(), parseFloat()
9. Convert numbers in JS to character types: (""+ variables)
10. The length of the string in JS is: (length)
11. The + sign is used when characters in JS are connected to characters.
12. The comparison operators in JS include: == equal to, != not equal to,>,>=,<.<=
13. Declaring variables in JS use:var to declare
14. The structure of judgment statements in JS: if(condition){}else{}
15. Loop structure in JS: for([initial expression];[condition];[upadte expression]) {inside loop}
16. The command to abort the loop is: break
17. Function definition in JS: function functionName([parameter],...){statement[s]}
18. When multiple form forms appear in the file, you can use document.forms[0] and document.forms[1] instead.
19. Window: Open window window.open(), close a window: window.close(), window itself: self
20. Status bar settings: window.status="character";
21. Popup prompt message: window.alert("character");
22. The confirmation box pops up: window.confirm();
23. The input prompt box pops up: window.prompt();
24. Specify the current location of the link: window.location.href="URL"
25. Remove the number of all forms in the form: document.forms.length
26. Close the output stream of the document: document.close();
27. Append string connector: +=
28. Create a document element: document.createElement(), document.createTextNode()
29. Method to obtain elements: document.getElementById()
30. Set the value of all text type members in the form to empty:
var form = window.document.forms[0]
for (var i = 0; i<form.elements.length;i++){
if (form.elements[i].type == "text"){
form.elements[i].value = "";
}
}
31. The check button is selected in JS: document.forms[0].checkThis.checked (the checked attribute means whether it is selected and returns TRUE or FALSE)
32. Radio button group (the names of radio buttons must be the same): take the length of the radio button group document.forms[0].groupName.length
33. Checked is also used to determine whether the radio button group is selected.
34. The value of the drop-down list box: document.forms[0].selectName.options[n].value (n Sometimes the drop-down list box name plus .selectedIndex is used to determine the selected value)
35. Definition of string: var myString = new String("This is lightsword");
36. Convert string to uppercase: string.toUpperCase(); Convert string to lowercase: string.toLowerCase();
37. Returns the position where string 2 appears in string 1: String1.indexOf("String2")!=-1 means that it is not found.
38. Take a character at the specified position in the string: StringA.charAt(9);
39. Take out the substring that specifies the start and end points in the string: stringA.substring(2,6);
40. Mathematical functions: Math.PI (return pi), Math.SQRT2 (return to square), Math.max(value1, value2) returns the most value of the two numbers, Math.pow(value1,10) returns the tenth power of value1, Math.round(value1) rounding function, Math.floor(Math.random()*(n+1)) returns the random number
41. Define date-type variables: var today = new Date();
42. Date function list: dateObj.getTime() gets the time, dateObj.getYear() gets the year, dateObj.getFullYear() gets the year, dateObj.getMonth() gets the month, dateObj.getDate() gets the year
Day, dateObj.getDay() gets the date, dateObj.getHours() gets the hour, dateObj.getMinutes() gets the minutes, dateObj.getSeconds() gets the seconds, dateObj.setTime(value) sets the time, dateObj.setYear(val) sets the year, dateObj.setMonth(val) sets the month, dateObj.setDate(val) sets the day of the week, dateObj.setDay(val) sets the day of the week, dateObj.setHours sets the hour, dateObj.setMinutes(val) sets the minutes, dateObj.setSeconds(val) sets the seconds [Note: This date and time starts from 0]
43.FRAME representation method: [window.]frames[n].ObjFuncVarName,frames["frameName"].ObjFuncVarName,frameName.ObjFuncVarName
44.parent represents the parent object, top represents the top object
45. The parent window that opens the child window is: opener
46. Indicates the current location: this
47. When calling JS functions in a hyperlink, use: (javascript:) to start with the function name after adding the function name
48. Don't execute this JS in old browsers:<!-- //->
49. Quoting a file-based JS:<script type="text/javascript" src="aaa.js"></script>
50. Specify HTML displayed in browsers that do not support scripts: <noscript></noscript>
51. When both hyperlink and ONCLICK events are present, the old version of the browser will turn to a.html, otherwise turn to b.html. Example: <a href="a.html" >dfsadf</a>
52. The built-in objects of JS are: Array, Boolean, Date, Error, EvalError, Function, Math, Number, Object, RangeError, ReferenceError, RegExp, String, SyntaxError, TypeError, URIError
53.Line breaks in JS:/n
54. Window full screen size: <script>function fullScreen(){ this.moveTo(0,0); this.outerWidth=screen.availWidth; this.outerHeight=screen.availHeight;}
window.maximize=fullScreen;</script>
55. All in JS represents all elements below it
56. Focus order in JS: document.getElementByid("form element").tabIndex = 1
57. The value of innerHTML is the value of the form element: if <p id="para">"how are <em>you</em>"</p>, then the value of innerHTML is: how are <em>you</em>
58. The value of innerTEXT is the same as above, but the mark is not displayed.
59. contentEditable can set whether the element can be modified, and isContentEditable returns the state of whether it can be modified.
60.isDisabled determines whether it is a prohibited state.disabled sets a prohibited state
61.length gets the length and returns the integer value
62.addBehavior() is an external function file called by JS, which has an extension of .htc
63.window.focus() makes the current window ahead of all windows.
64.blur() refers to losing focus. In contrast to FOCUS().
65.select() refers to the element being selected.
66. Prevent users from entering text into the text box:
67. Remove the number of occurrences of this element in the page: document.all.tags("div (or other HTML tags)").length
68.JS is divided into two forms outputs: modal and non-modal.window.showModaldialog(),window.showModeless()
69. Settings of status column text: window.status='text', default status column text settings: window.defaultStatus = 'text.';
70. Add to favorites: external.AddFavorite("http://www.xrss.cn","jaskdlf");
71. Do not do anything when encountering script errors in JS: window.onerror = doNothing; The syntax for specifying the error handle is: window.onerror = handleError;
72. Specify the parent window of the currently open window in JS: window.opener, and supports multiple continuations of opener.opener...
73. Self in JS refers to the current window
74. The content displayed in the status bar in JS: 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();
77. The box to propose whether to confirm in JS: if(confirm("Are you sure?")){alert("ok");}else{alert("Not Ok");}
78. Window redirection in JS: window.navigate("http://www.sina.com.cn");
79. Print in JS: window.print()
80. The prompt input box in JS: window.prompt("message","defaultReply");
81. Window scrollbar in JS: window.scroll(x,y)
82. The window in JS scrolls to position: window.scrollby
83. Set time interval in JS: setInterval("expr",msecDelay) or setInterval(funcRef,msecDelay) or setTimeout
84. The modals in JS are displayed in IE4+ lines, but not in NN: showModalDialog("URL"[,arguments][,features]);
85. The handle used before exit in JS: function verifyClose(){event.returnValue="we really like you and hope you will stay longer.";}} window.onbeforeunload=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. window.location properties: protocol(http:),hostname(www.example.com), port(80), host(www.example.com:80), pathname("/a/a.html"), hash("#giantGizmo", refers to jumping to the corresponding anchor), href(all information)
89.window.location.reload() refreshes the current page.
89-1.parent.location.reload() refreshes the parent object (for framework)
89-2.opener.location.reload() refreshes the parent window object (for single-open window)
89-3.top.location.reload() refreshes the top object (used to multi-windows)
90.window.history.back() returns to the previous page,window.history.forward() returns to the next page,window.history.go (return to the page, you can also use the visited URL)
91.document.write() output without line breaks, document.writeln() output without line breaks
92.document.body.noWrap=true; prevents link text from folding.
93. Variable name.charAt (that bit), take the character of the variable in which bit bit.
94. "abc".charCodeAt (this number), returns the ASCii code value of the number of characters.
95. String concatenation: string.concat(string2), or use += to connect
96. Variable.indexOf("character", start position), return the first occurrence position (calculated from 0)
97.string.lastIndexOf(searchString[,startIndex]) last appears.
98.string.match(regExpression), determines whether the characters match.
99.string.replace(regExpression,replaceString) replaces the existing string.
100.string.split (delimiter) returns an array to store values.
101.string.substr(start[,length]) takes the string from the specified length from which bit.
102.string.toLowerCase() makes all strings lowercase.
103.string.toUpperCase() turns all characters into capitalization.
104.parseInt(string[,radix(represents binary)]) cast into an integer.
105.parseFloat(string[,radix]) cast to floating point type.
106.isNaN (variable): Test whether it is numerical.
107. Define the keywords for constants: const, define the keywords for variables: var
In the end, I didn’t get enough of 100 singles and eight generals. I’ll regret it. Can you help me make up for it?