1.document.GetElementsByTagName can get all the elements of a certain tag. You can get all the elements on the page through
document.getElementsByTagName('*')
. The asterisk here represents any tag, and the comment tag The tagName is "!"
2. The difference between String method substr and substring
substr(start[,length]);//Indicates taking length strings from the start position
substring (start, end);//Represents the string from start to end, including the character at the start position but excluding the character at the end position
3. "==" and "==="
The former compares two objects and will automatically perform type conversion. For example, comparing '12' == 12 will return true; while the latter does not perform any conversion and must be completely equal to '12' === 12 will return false
4. How to prevent the webpage from being saved
5. Use document.referrer to get the address of the previous page
6. Use the form attribute of the input element to get the form element to which the input belongs
7. The defer attribute in the Script tag
is used to tell the browser that it can continue to execute html without first executing the js code specified by src until it cannot continue to execute.
8. Through arguments, you can get an array of all parameters passed to the currently executed function, even if you do not define any parameters for the function.
9. You can use document.anchors to get all the link elements on the page instead of using
document.getElementsByTagName('A');
The same is true:
document.forms
document.images
10. Use js to determine whether the client machine has the .net framework installed
function hasDotNetFramework(){return navigator.userAgent.indexOf(".NET CLR") > - 1;}
11. Use "instead of """ in client events
For example:
var html = 'hello';