For example, the following code:
Copy codeThe Code is as follows:
<Html>
<Body>
<Script language = "JavaScript">
<! --
If (document. all)
Alert ("this is a IE ");
Else
Alert ("this is a Mozilla ");
// -->
</SCRIPT>
</Body>
</Html>
"This is a IE" is output in IE browser ";
In firefox, "this is a Mozilla" is output ".
However, the document. all attribute method is not supported in firefox.
The following code runs normally in IE and firefox browsers
Copy codeThe Code is as follows:
<Html>
<Body>
<Input type = "text" id = "txt" value = "ddd"/>
<Script language = "JavaScript">
<! --
Var v = document.all.txt. value;
Alert (v );
// -->
</SCRIPT>
</Body>
</Html>
This is because the newer FF performs special processing on all. JS will return the JSVAL_VOID (that is, false) value when detecting that only the individual all attribute is in the Zhaoxing process;
When JS detects an image like 'if (o. p)... 'or' (o. p )?... :... ', Returns an HTMLCOLLECTION object.
In the GOOGLE browser, there is a dual division for all, which is both a COLLECTION and a js void (false) value.