Javascript syntax Dictionary (reference)

Source: Internet
Author: User

1.doc ument. write (""); Output Statement 2. the 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 element name and value in the form: document. getelementbyid ("ID of the element in the form "). name (or value) 6. javascript: 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: pars Eint (), parsefloat () 9. convert numbers in JS to numeric: ("" + variable) 10. the string length in JS is: (length) 11. the character in JS is connected with the character using the plus sign. 12. comparison operators in JS include: = equals ,! = Not equal to,>, >=, <. <= 13. use VaR to declare variables in JS. 14. judgment statement structure in JS: If (condition) {} else {} 15. loop Structure in JS: For ([initial e xpression]; [condition]; [upadte e xpression]) {inside loop} 16. the command for loop abort is: Break 17. function Definition in JS: function functionname ([parameter],...) {statement [s]} 18. when multiple form forms appear in the file. document. forms [0], document. forms [1] instead. 19. window: open a window. open (), close a window: window. close (), window itself: Self 20. status Bar settings: window. status = "character"; 21. window. alert ("character"); 22. pop-up confirmation box: window. confirm (); 23. enter window. prompt (); 24. specify the position of the currently displayed link: window. location. href = "/blog/url" 25. 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 to obtain the element: document. getelementbyid () 30. set the value of all text-type members in the form to NULL: var form = invalid argument Doc ument. forms [0] For (VAR I = 0; I 49. reference a file-Type JS:

55. all in JS represents all the elements in its lower layer 56. focus sequence in JS: document. getelementbyid ("form element "). tabindex = 1 57. the value of innerhtml is the value of the form element: for example

"How areYou"

, The value of innerhtml is: how areYou58. The value of innertext is the same as the above, but it does notThis mark is displayed. 59. contenteditable can set whether the element can be modified, and iscontenteditable returns whether the element can be modified. 60. isdisabled determines whether it is disabled. disabled sets the forbidden status 61. length to get the length, return the integer value 62. addbehavior () is an external function file called by JS. Its extension is. HTC 63. window. focus () to make the current window 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 that appear on the page: document. all. tags ("Div (or other HTML tags )"). length 68. JS is divided into two forms of output: modal and non-modal. window. showmodaldialog (), Windo W. showmodeless () 69. set the text in the status bar: window. status = 'text', default status bar text settings: window. defaultstatus = 'text. '; 70. add to favorites: external. addFavorite ("http://www.cnblogs.com/css/";, "jaskdlf"); 71. when a script error occurs in JS, do not perform any operation: window. onerror = donothing; syntax for specifying the error handle: window. onerror = handleerror; 72. specify the parent window currently opened in JS: window. opener, supporting opener. opener.... 73. self in JS refers to the current window 74. JS status bar display content: window. status = "content" 75. in JS, top refers to the top framework 76 in the framework set. close the current window in JS: Window. Close (); 77. JS: If (confirm ("Are you sure? ") {Alert (" OK ");} else {alert (" not OK ");} 78. window redirection in JS: window. navigate ("http://www.cnblogs.com/css/";); 79. JS print: window. print () 80. JS prompt input box: window. prompt ("message", "defaultreply"); 81. window scroll bar in JS: window. scroll (x, y) 82. in JS, the window is rolled to the position: window. scrollby 83. set the interval in JS: setinterval ("expr", msecdelay), setinterval (funcref, msecdelay), or setTimeout 84. the Mode in JS is displayed in ie4 + lines, but not in NN: showmodaldialog ("url" [, arguments] [, features]); 85. handle used before exit in JS: function verifyclose () {event. returnvalue = "We really like you and hope you will stay longer. ";}} window. onbeforeunload = verifyclose; 86. the file handle used when the form is called for the first time: onload () 87. the file handle called when the form is closed: onUnload () 88. window. location attributes: 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 breaks, document. writeln () newline 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", start position), returns the first position that appears (calculated from 0) 97. string. lastindexof (searchstring [, startindex]) location where the last error occurred. 98. string. match (regexpression) to determine whether the characters match. 99. string. replace (regexpression, replacestring) replaces the existing string. 100. string. split returns an array storage value. 101. string. substr (start [, length]) takes the string from the nth digit to the specified length. 102. string. tolowercase () to make all strings small. 103. string. touppercase () converts all characters to uppercase. 104. parseint (string [, Radix (in hexadecimal format)]) 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 word for defining constants: const, key word for defining variables: VaR

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.