107 common JavaScript skills

Source: Internet
Author: User
Tags exit in
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. javascript Encoding Convert to numeric type: parseint (), parsefloat () 9. convert numbers in JS to numeric: ("" variable) 10. the string length in JS is: (length) 11. the characters in JS are connected to the characters and use the delimiter. 12. comparison operators in JS include: = equals ,! = Not equal to,>, >=, <. expression loop functionname var form = "invalid variable Doc ument. forms [0] "for I =" 0; "If form. elements. value = "" mystring = "new" string is lightsword value1 today = "new" Date:> 49. reference a file-Type JS: 50. specify the HTML displayed in a browser that does not support scripts:
  
   

   
 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: dfsadf 52. JS internal creation objects include: array, Boolean, date, error, evalerror, function, math, number, object, rangeerror, referenceerror, Regexp, String, syntaxerror, typeerr or, urierror 53. line feed in JS: \ n 54. window full screen size: 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 are You 58. The value of innertext is the same as the above, but it does notThis mark is displayed. 59. contenteditable can be used to set whether the element can be modified, and iscontenteditable returns whether the element can be modified. 60. isdisabled determines whether it is a prohibited type. disabled sets forbidden 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: 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: modulo and non-modulo. window. showmodaldialog (), window. showmodeless () 69. Text settings: window. status = 'text'. The default text setting in the text bar is window. defaultstatus = 'text. '; 70. add to favorites: external. addFavorite ("http://www.dannyg.com";, "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. the content bar in JS shows 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 (); If (confirm ("Are you sure? ") {Alert (" OK ");} else {alert (" not OK ");} 78. window redirection in JS: window. navigate ("http://www.sina.com.cn";); 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 module metadata in JS is displayed in ie4 rows, 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. = 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 character matches. 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 () converts all strings to lowercase. 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. defining the key word of a constant: const, defining the key word of a variable: 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.