<span id="Label3"></p><pre>1.document.write (""<span style="color: #000000;"><span style="color: #000000;">); for Output statements</span></span>The comment in 2.JS is<span style="color: #008000;"><span style="color: #008000;">//</span></span>3. The traditional HTML document order Is:document->html-><span style="color: #000000;"><span style="color: #000000;">(head,body)</span></span>4. The DOM order in a browser window is:window-><span style="color: #000000;"><span style="color: #000000;">(navigator,screen,history,location,document)</span></span>5. Get the name and value of the element in the Form: document.getelementbyidx_x_x ("id number of element in form"<span style="color: #000000;"><span style="color: #000000;">). name (or Value)</span></span>6. A lowercase capitalization JS:document.getElementByIdx_x_x ("output"). value=document.getelementbyidx_x_x ("input"<span style="color: #000000;"><span style="color: #000000;">). value.touppercase ();</span></span>7<span style="color: #000000;"><span style="color: #000000;">. Value type in Js: string,number,boolean,null,object,function</span></span>8<span style="color: #000000;"><span style="color: #000000;">. The character type in JS is converted into numerical type: parseint (), parsefloat ()</span></span>The numbers in 9.JS are converted into character types: ("" +<span style="color: #000000;"><span style="color: #000000;">Variable)</span></span>10<span style="color: #000000;"><span style="color: #000000;">. The length of the string in JS is: (length)</span></span>The characters in 11.JS are connected with the word typeface +<span style="color: #000000;"><span style="color: #000000;">Number.</span></span>The comparison operator in 12.JS has: = = equals,! = does not equal, >,>=,<.<=13<span style="color: #000000;"><span style="color: #000000;">. Declaring variables in JS using: var to declare</span></span>The structure of judgment statements in 14.JS:<span style="color: #0000ff;"><span style="color: #0000ff;">if</span></span>(condition) {}<span style="color: #0000ff;"><span style="color: #0000ff;">Else</span></span><span style="color: #000000;"><span style="color: #000000;">{}</span></span>Loop structure in 15.JS:<span style="color: #0000ff;"><span style="color: #0000ff;"></span> for</span><span style="color: #000000;"><span style="color: #000000;">([initialexpression];[ condition]; [upadteexpression]) {insideloop}</span></span>16. The circular abort command is:<span style="color: #0000ff;"><span style="color: #0000ff;"></span> break</span>17<span style="color: #000000;"><span style="color: #000000;">. function definition in js: functionfunctionname ([parameter],...) {statement[s]}</span></span>18. When multiple form forms appear in a file. can be used document.forms[0],document.forms[1<span style="color: #000000;"><span style="color: #000000;">] to Replace.</span></span>19<span style="color: #000000;"><span style="color: #000000;">. window: open Window window.open (), close a window: window.close (), window itself: self</span></span>20. Status bar settings: window.status= "character"<span style="color: #000000;"><span style="color: #000000;">;</span></span>21. Popup message: Window.alert ("character")<span style="color: #000000;"><span style="color: #000000;">);</span></span>22<span style="color: #000000;"><span style="color: #000000;">. Popup confirmation box: window.confirm ();</span></span>23<span style="color: #000000;"><span style="color: #000000;">. Popup input prompt box: window.prompt ();</span></span>24. Specify the location of the current display link: window.location.href= "URL" 25<span style="color: #000000;"><span style="color: #000000;">. Remove the number of all forms in the Form: document.forms.length</span></span>26<span style="color: #000000;"><span style="color: #000000;">. Close the output stream of the document: document.close ();</span></span>27. String Append connector: +=28<span style="color: #000000;"><span style="color: #000000;">. Create a document element: document_createelement_x_x (), document_createtextnode ()</span></span>29<span style="color: #000000;"><span style="color: #000000;">. Method of getting elements: document.getelementbyidx_x_x ()</span></span>30<span style="color: #000000;"><span style="color: #000000;">. Set the value of the members of all text types in the form to be null: varform</span></span>=window.document.forms[0<span style="color: #000000;"><span style="color: #000000;">]</span></span><span style="color: #0000ff;"><span style="color: #0000ff;"></span> for</span>(vari=0;i<!--<span style="color: #008000;"><span style="color: #008000;">//</span></span><span style="color: #008000;"><span style="color: #008000;"></span> -</span>49. refer to a file-type js:<scripttype= "text/javascript" src= "aaa.js" ></script>50. Specify the html:< that is displayed in browsers that do not support scripting noscript></noscript>51. when hyperlinks and onclick events are sometimes, the old version of the browser turns to a.html, otherwise it turns to B.html. example: <ahref= "a.html" onclick= " location.href= ' b.html '; returnfalse ">dfsadf</a>52<span style="color: #000000;"><span style="color: #000000;">. JS built-in objects Are: array,boolean,date,error,evalerror,function,math,number,object,rangeerror,referenceerror,regexp, String,syntaxerror,typeerror,urierror</span></span>53<span style="color: #000000;"><span style="color: #000000;">. Line break in Js: \ n</span></span>54. window Full Screen size: <script>functionfullscreen () {<span style="color: #0000ff;"><span style="color: #0000ff;"></span> this</span>. MoveTo (0,0);<span style="color: #0000ff;"><span style="color: #0000ff;"></span> this</span>. outerwidth=screen.availwidth;<span style="color: #0000ff;"><span style="color: #0000ff;"></span> this</span>. outerheight=screen.availheight;} Window.maximize=fullscreen;</script>55<span style="color: #000000;"><span style="color: #000000;">. All of JS represents all of its underlying elements.</span></span>Focus order in 56.JS: document.getelementbyidx_x_x ("form element"). The value of tabindex=157.innerhtml is the value of the form element: such as <pid= "para" > "howare <em>you</em> <p></p>, The value of innerHTML is: the value of Howare<em>you</em>58.innertext is the same as above , but will not put <em><span style="color: #000000;"><span style="color: #000000;">This tag is Displayed.</span></span>59<span style="color: #000000;">the <span style="color: #000000;">. Contenteditable can set whether the element can be modified, iscontenteditable returns whether the state</span> is Modifiable.</span>60<span style="color: #000000;"><span style="color: #000000;">The. isdisabled Determines whether the status is Forbidden. disabled setting the Forbidden State</span></span>61<span style="color: #000000;"><span style="color: #000000;">. Length Get length, return integral type value</span></span>62<span style="color: #000000;"><span style="color: #000000;">. Addbehavior () is a JS called external function file whose extension is. HTC</span></span>63<span style="color: #000000;"><span style="color: #000000;">. Window.focus () causes the current window to precede all Windows.</span></span>64<span style="color: #000000;"><span style="color: #000000;">. Blur () refers to the loss of focus. in contrast to focus ()</span> .</span>65<span style="color: #000000;"><span style="color: #000000;">. Select () refers to elements that are selected.</span></span>66. prevent users from entering text into text boxes: onfocus= "this.blur ()" 67. Remove the number of occurrences of the element in the Page: document.all.tags ("p (or other HTML tag)"<span style="color: #000000;"><span style="color: #000000;">). Length</span></span>68<span style="color: #000000;"><span style="color: #000000;">. JS is divided into two forms of output: modal and Non-modal. window.showmodaldialog (), window.showmodeless ()</span></span>69. status bar text settings: window.status= ' text ', default status bar text settings: window.defaultstatus= ' Text. '<span style="color: #000000;"><span style="color: #000000;">;</span></span>70. Add to Favorites: external. Addfavorite ("http://www.google.com", "google"<span style="color: #000000;"><span style="color: #000000;">);</span></span>No action is made when a script error is encountered in 71.JS: window.onerror=donothing; specifies the syntax for the error handle: window.onerror=<span style="color: #000000;"><span style="color: #000000;">handleError;</span></span>72<span style="color: #000000;"><span style="color: #000000;">. JS Specifies the parent window of the currently open Window: window.opener, support Opener.opener ... The multiplicity of Continuation.</span></span>73<span style="color: #000000;"><span style="color: #000000;">. The self in JS refers to the current window</span> .</span>74.JS status bar display content: window.status= "content" 75<span style="color: #000000;"><span style="color: #000000;">. The top in JS refers to</span> the topmost frame in the frame set.</span>76<span style="color: #000000;"><span style="color: #000000;">. JS Close the current window: window.close ();</span></span>The box for confirmation in 77.JS:<span style="color: #0000ff;"><span style="color: #0000ff;">if</span></span>(confirm ("areyousure?")) {alert ("ok");}<span style="color: #0000ff;"><span style="color: #0000ff;">Else</span></span>{alert ("notok"<span style="color: #000000;"><span style="color: #000000;">);}</span></span>window redirection in 78.JS: window.navigate ("http://www.google.com"<span style="color: #000000;"><span style="color: #000000;">);</span></span>79<span style="color: #000000;"><span style="color: #000000;">. JS print: window.print ()</span></span>Prompt input box in 80.JS: window.prompt ("message", "defaultreply")<span style="color: #000000;"><span style="color: #000000;">);</span></span>81<span style="color: #000000;"><span style="color: #000000;">. The window scroll bar in js: window.scroll (x, y)</span></span>82<span style="color: #000000;"><span style="color: #000000;">. JS window scroll to location: Window.scrollby</span></span>Set time interval in 83.JS: setinterval ("expr"<span style="color: #000000;"><span style="color: #000000;">, Msecdelay) or setinterval (funcref,msecdelay) or settimeout</span></span>Modal display in 84.JS in ie4+ line, not in nn: ShowModalDialog ("URL"<span style="color: #000000;"><span style="color: #000000;">[, arguments][,features]);</span></span>Handle used before exiting in 85.JS: functionverifyclose () {event.returnvalue= "wereallylikeyouandhopeyouwillstaylonger.";}} Window.onbeforeunload=<span style="color: #000000;"><span style="color: #000000;">verifyclose;</span></span>86<span style="color: #000000;"><span style="color: #000000;">. The file handle used when the form was first called: onload ()</span></span>87<span style="color: #000000;"><span style="color: #000000;">the file handle that is called when the form closes: onunload ()</span></span>88.window.location properties: Protocol (http:), hostname (www.example.com), Port (+), host (www.example.com:80), Pathname ("/a /a.html "), Hash (" #giantGizmo "<span style="color: #000000;">to <span style="color: #000000;">jump to the appropriate anchor), href (all information)</span></span>89<span style="color: #000000;"><span style="color: #000000;">. Window.location.reload () Refreshes the current Page.</span></span>89-1<span style="color: #000000;"><span style="color: #000000;">. Parent.location.reload () Refresh Father Object (for Frame)</span></span>89-2<span style="color: #000000;"><span style="color: #000000;">. Opener.location.reload () Refreshes the parent window object (for single-open windows)</span></span>89-3<span style="color: #000000;"><span style="color: #000000;">. Top.location.reload () Refreshes the topmost object (for multiple open Windows)</span></span>90<span style="color: #000000;"><span style="color: #000000;">. Window.history.back () returns to the previous page, Window.history.forward () returns to the next page, window.history.go (returns to the page, or using the URL visited)</span></span>91<span style="color: #000000;"><span style="color: #000000;">. document.write () output with no newline, document.writeln () line Wrap output</span></span>92.document.body.nowrap=<span style="color: #0000ff;"><span style="color: #0000ff;">true</span></span><span style="color: #000000;"><span style="color: #000000;">; Prevent link text</span> from wrapping.</span>93<span style="color: #000000;"><span style="color: #000000;">. Variable Name. charAt (number of), Take the character</span> of the Variable.</span>94. "abc"<span style="color: #000000;"><span style="color: #000000;">. charCodeAt (number of), Returns the ASCII code value of the first few Characters.</span></span>95. string connection: String.Concat (string2), or with + =<span style="color: #000000;"><span style="color: #000000;">to connect</span></span>96. Variable. indexOf ("character")<span style="color: #000000;"><span style="color: #000000;">, start position), return to the first occurrence (calculated from 0)</span></span>97<span style="color: #000000;"><span style="color: #000000;">the last occurrence of The. string.lastindexof (searchstring[,startindex]) Position.</span></span>98<span style="color: #000000;"><span style="color: #000000;">. String.match (regexpression) to determine if the characters Match.</span></span>99<span style="color: #000000;"><span style="color: #000000;">Replace the existing string With. string.replace (regexpression,replacestring).</span></span>100<span style="color: #000000;">the <span style="color: #000000;">. String.Split (delimiter) Returns an array of stored Values.</span></span>101<span style="color: #000000;"><span style="color: #000000;">. String.substr (start[,length]) takes a string from the first to the specified Length.</span></span>102<span style="color: #000000;"><span style="color: #000000;">. String.tolowercase () makes the string all Lowercase.</span></span>103<span style="color: #000000;"><span style="color: #000000;">. String.touppercase () makes all characters uppercase.</span></span>104<span style="color: #000000;"><span style="color: #000000;">. parseint (string[,radix (on behalf Of)]) is cast to an integral type.</span></span>105<span style="color: #000000;"><span style="color: #000000;">. parsefloat (string[,radix]) cast to floating-point type.</span></span>106<span style="color: #000000;"><span style="color: #000000;">. IsNaN (variable): Whether the test is a numeric type.</span></span>107. define a constant keyword: const, The keyword that defines the variable:<span style="color: #0000ff;"><span style="color: #0000ff;">var</span></span>.</pre><p><p></p></p><p><p>function collation of JS common method</p></p></span>
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.