JavaScript related accumulation

Source: Internet
Author: User
Tags mathematical functions set time

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. Gets 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 (); Values type in 7.JS: String, The character type in the number,boolean,null,object,function8.js is converted to a numeric type: parseint (), and the number in the parsefloat () 9.JS is converted to a character type: ("" variable) The string length in 10.JS is: (length) the character in 11.JS with the word typeface connection use number. The comparison operator in 12.JS has the following: = = equals,! = does not equal, >,>=,<.<=13.js declares the variable using: var to declare 14. The structure of the judgment statement in JS: the loop structure in if (condition) {}else{}15.js: for ([Initial expression];[ Condition]; [Upadte expression]) {inside loop}16. The command for The Loop abort is: Break17. Functions definition in JS: function functionname ([parameter],...) {statement[s]}18. When multiple form forms appear in a file. You can use Document.forms[0],document.forms[1] instead. 19. window: Opens window Windows. Open (), close a window: window.close (), window itself: Self20. Settings for the Status bar: window. status= "character"; 21. Pop-up prompt message: window. Alert ("character"); 22. Popup Confirmation Box: window. Confirm (); 23. Popup Input Prompt box: window. Prompt (); 24. Specify the bits of the currently displayed linkReset: window.location.href= "URL" 25. Remove the number of all forms in the form: document.forms.length26. Close the output stream for the document: documents. Close (); 27. String Append connector: =28. Create a document element: Document.createelement (), document.createTextNode () 29. Methods for getting elements: document.getElementById () 30. Sets the value of the member of all text types in the form to be null: var form = Window.document.forms[0]for (var i = 0; i<    Form.elements.length;i) {if (Form.elements.type = = "Text") {form.elements.value = ""; }}31. Check button in JS to determine whether to select: Document.forms[0].checkthis.checked (The Checked property represents whether to return true or False for check) 32. radio button Group (the name of the radio button must be the same): The length of the radio button group is document.forms[0].groupname.length33. radio button group to determine whether it is selected is also used checked.34. The value of the drop-down list box: Document.forms[0]. Selectname.options[n].value (n sometimes use a drop-down list box name plus. SelectedIndex to determine the selected value) 35. The definition of a string: var myString = new String ("This is Lightsword "); 36. Turn the string into uppercase: String.touppercase (); The string is converted to lowercase: string.tolowercase (); 37. Returns the position where the string 2 appears in string 1: String1.indexof ("String2")!=-1 the description was not found. 38. Takes a character in the specified position in the string: Stringa.charat (9); 39. Remove the substring that specifies the start and end points in the string: stringa.substring (2,6); 40. Mathematical Functions: Math.PI (Return to PI), Math.sqrt2 (return to root), Math.max (value1,value2) returns the maximum value in two digits, Math.pow (value1,10)Return value1 10 times, Math. Round (value1) rounding function, Math.floor (Math.random () * (n 1)) returns a random number 41. Define a Date Variant: var today = new Date (); 42. List of date functions: Dateobj.gettime () Get time, dateobj.getyear () Get the Year, Dateobj.getfullyear () get four-bit year, dateobj.getmonth () Get the Month, dateobj.getdate () Get the day, Dateobj.getday () Gets the day of the Week, Dateobj.gethours () Gets the Hour, dateobj.getminutes () gets points, dateobj.getseconds () gets seconds, Dateobj.settime ( Value) Set the time, Dateobj.setyear (Val) to set the year, Dateobj.setmonth (Val) to set the month, Dateobj.setdate (Val) to set the day, Dateobj.setday (Val) to set the days of the week, Dateobj.sethours set Hours, Dateobj.setminutes (Val) set points, Dateobj.setseconds (val) Set seconds [Note: This date time starts with a 0-based representation of the]43.frame: [Window .] Frames[n]. objfuncvarname,frames["FrameName"]. Objfuncvarname,framename.objfuncvarname44.parent represents the Father object, top represents the topmost object 45. The parent window of the Open child window is: opener46. Represents the location that is currently owned: This47. When invoking the JS function in a hyperlink: (JavaScript:) to start with the function name 48. This js:< is not performed in the old browser!--//-->49. References a file-type Js:<script type= "text /javascript "src=" Aaa.js "></script>50. Specifies the html:<noscript></noscript>51 that is displayed in browsers that do not support scripting. When both the hyperlink and the OnClick event are sometimes, the old version of the browser turns to a.html, otherwise turns to b.html. Example: <a href= "a.html" onclick= "location.href= ' b.html '; return false" >dfsadf</a>[pagesplitxx]52.js's built-in objects are: Array,boolean,date,error, Evalerror,function,math,number,object,rangeerror,referenceerror,regexp,string,syntaxerror,typeerror, NewLine in Urierror53.js: \n54. Window full Screen size: <script>function fullscreen () {This.moveto (0,0); this.outerwidth= Screen.availwidth;this.outerheight=screen.availheight;} All in window.maximize=fullscreen;</script>55.js represents the focus order in all element 56.JS of its lower layer: document.getElementById ("form element"). The value of TabIndex = 157.innerHTML is the value of the form element: such as <p id= "para" > "How is <em>you</em>" </p&gt, then the value of innerHTML is: How is the value of <em>you</em>58.innertext is the same as above, except that the <em> is not shown. 59.contentEditable can set whether the element can be modified, Iscontenteditable returns whether the state can be modified. 60.isDisabled Determines whether the status is forbidden. Disabled set Disable status 61.length get length, return integer value 62.addBehavior () An external function file that is a JS call whose extension is. htc63.window.focus () causes the current window to be before all windows. 64.blur () refers to the loss of focus. In contrast to focus (). 65.select () Indicates that the element is selected. 66. Prevent users from entering text into text boxes: onfocus= "This.blur ()" 67. Remove the number that the element appears in the page: Document.all.tags ("div (or other HTML tag)"). length68 . JS are divided intoTwo form outputs: modal and non-modal. window.showModalDialog (), Window.showmodeless () 69. Status bar text settings: window.status= ' text ', default status bar text settings: Window.defaultstatus = ' text. '; 70. Add to Favorites: External. Addfavorite ("http://www.dannyg.com";, "Jaskdlf"), no action is made when a script error is encountered in 71.JS: Window.onerror = doNothing; The syntax for specifying an error handle is: Window.onerror = handleerror;72.js Specifies the parent window of the currently open window: Window.opener, supports Opener.opener ... The multiple continuation of the. 73.JS in the current window 74.JS in the status bar display content: window.status= "Content" 75.JS in the top refers to the frame set the topmost frame in 76.JS closed the current window: Window.close (); box for confirmation in 77.JS: if (Confirm ("Is you sure?")) {Alert ("OK");} Else{alert ("not OK");} Window redirection in 78.JS: Window.navigate ("http://www.sina.com.cn";); 79.JS in print: Window.print () 80.JS in the prompt input box: window.prompt (" Message "," defaultreply "); window scroll bar in 81.JS: Window.Scroll (x, y) 82.JS window scroll to position: Window.scrollby83.JS set time interval: setinterval ("expr", Msecdelay) or setinterval (Funcref,msecdelay) or settimeout84.js are displayed in the IE4 line, not in nn: ShowModalDialog ("URL" [, Arguments][,features]) 85.JS, the handle used before exiting: function Verifyclose () {event.returnvalue= "We really like you and hope Stay longer. ";}} Window.=verifyclose;86. The file handle that is used when the form is first called: onload () 87. The file handle that is called when the form closes: OnUnload () 88.window.location Properties: Protocol (http:), hostname ( www.example.com), port (+), 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 () refreshes the current page. 90.window.history.back () returns to the previous page, Window.history.forward () returns to the next page, Window.history.go (return to page, you can also use the URL you have visited) 91.document.write () non-wrapped output, document.writeln () line-Wrapping output 92.document.body.nowrap= True to prevent linked text from wrapping. 93. Variable name. CharAt (number of), take the character of the variable. 94. " ABC ". charCodeAt (number of), returns the ASCII value of the first few characters. 95. String Connection: String.Concat (string2), or connect with = 96. Variable. IndexOf (" character ", start position), Returns the position of the first occurrence (calculated from 0) 97.string.lastindexof (Searchstring[,startindex]) last occurrence. 98.string.match (regexpression), Determines whether the character matches. 99.string.replace (regexpression,replacestring) replaces the existing string. 100.string.split (delimiter) Returns an array store value. 101.STRING.SUBSTR (Start[,length]) takes a string from the first to the specified length. 102.string.tolowercase () Makes the string all lowercase. 103.string.touppercase () makes all characters uppercase. 104.parseInt (String[,radix (on behalf of)]) cast to Integer. 105.parseFloat (string[, Radix]) cast to floating-point type. 106.isNaN (variable): The test is a numeric type.107. Define a constant keyword: const, the keyword that defines the variable: var 

JavaScript-related accumulation

Related Article

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.