JS skills you may not know)
1. document. getelementsbytagname can be used to obtain all elements of a tag. getelementsbytagname ('*') obtains all elements on the page. The asterisk represents any tag, and the tagname of the annotation tag is "!"
2. Differences between the string method substr and substring
Substr (start [, length]) indicates that length strings are obtained from the start position.
Substring (START, end) indicates a string from start to end, including the start position but not the end position.
3. "=" and "="
The former compares two objects and automatically performs type conversion. For example, if '12' = 12 is compared, true is returned. If the latter does not perform any conversion, it must be completely equal to '12' = 12, and false is returned.
4. How to Make webpages unavailable
<NoScript> <IFRAME src = *. html> </iframe> </NoScript>
5. Use document. Referrer to obtain the address of the previous page.
6. Use the form attribute of the input element to obtain the form element to which the input belongs.
7. Defer attribute in the script tag
The function is to tell the browser that HTML can be executed, instead of executing the JS Code specified by Src until the execution fails.
8. arguments can be used to obtain an array of all parameters passed to the currently executed function, even if you have not defined any parameters for the function.
9. You can use document. Anchors to obtain all the link elements on the page without using document. getelementsbytagname ('A'). Likewise, document. Forms, document. Images
10. Use js to determine whether the. NET Framework is installed on the client.
Function hasdotnetframework () {return navigator. useragent. indexof (". Net CLR")>-1 ;}
11. Use & quot; instead of "" in client events
For example, VAR html = '<a href = "javascript: Alert (& quot; this is message & quot;)"> Hello </a>'