Let's talk about the document. all attribute in ie and firefox.

Source: Internet
Author: User

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.

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.