29. method for getting the element: document. getElementById ()
30. Set the value of all text members in the form to NULL:
Var form = terraform Doc ument. forms [0]
For (var I = 0; I <form. elements. length; I ++ ){
If (form. elements. type = "text "){
Form. elements. value = "";
}
}
31. Check whether the check button is selected in JS: document. forms [0]. checkThis. checked (the checked attribute indicates whether to select and return TRUE or FALSE)
32. Single-choice button group (the names of Single-choice buttons must be the same): Take the length of Single-choice button Group document. forms [0]. groupName. length
33. The single-choice button group also uses checked to determine whether it is selected.
34. value of the drop-down list box: document. forms [0]. selectName. options [n]. value (n sometimes adds. selectedIndex to the name of the drop-down list box to determine the selected value)
35. String definition: var myString = new String ("This is lightsword ");
36. Convert string to uppercase: string. toUpperCase (); Convert string to lowercase: string. toLowerCase ();
37. Return the position where string 2 appears in string 1: String1.indexOf ("String2 ")! =-1 indicates no.
38. Take a character at the specified position in the string: StringA. charAt (9 );
39. Retrieve the substring of the specified start point and end point in the string: stringA. substring );
40. mathematical functions: Math. PI (returns the circumference rate), Math. SQRT2 (return to the initiator), 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 a random number.
41. Define a Date variable: var today = new Date ();
42. date function list: dateObj. getTime () Get the time, dateObj. getYear () returns the year, dateObj. getFullYear () returns the four-digit year, dateObj. getMonth () returns the month, dateObj. get date (), dateObj. getDay () returns the date (dateObj. getHours () returns the hour, dateObj. getMinutes (), dateObj. getSeconds () returns the second, dateObj. setTime (value) sets the time, dateObj. setYear (val): Year, dateObj. setMonth (val) sets month, dateObj. setDate (val) sets the date, dateObj. setDay (val) specifies the day of the week, dateObj. setHours: Set the hour, dateObj. setMinutes (val) set the score, dateObj. setSeconds (val) sets the second. [Note: this date and time start from 0]
44. parent indicates the parent object, and top indicates the top object.
45. Open the parent window of the Child Window: opener
46. indicates the current location: this
47. when calling the JS function in the hyperlink, use: (javascript :) to start with and add the function name
48. Do not execute this JS in the old browser: <! -- // -->
49. Reference a file-type JS: <script type = "text/javascript" src = "aaa. js"> </script>
50. Specify the HTML displayed in a browser that does not support scripts: <noscript> </noscript>
51.when both hyperchains and onclickjs are available, the browser turns to a.html and the browser turns to B .html. For example: <a href = "a.html" onclick = "location.href= B .html; return false"> dfsadf </a>
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.