After the Firefox FF ie page is loaded, the event innerhtml innertext

Source: Internet
Author: User

In the recent MD page, we need to consider ff and IE, so a lot of JS will have some problems.
It is best to use W3C standard L for coding.

<! -- This is the IE Method -->
<SCRIPT defer type = "text/JavaScript">
Subdate ();
</SCRIPT>

<SCRIPT type = "text/JavaScript">
// This is the FF Method
If (document. addeventlistener)
Document. addeventlistener ("domcontentloaded", function () {subdate () ;}, null );
</SCRIPT>

You can also:
<SCRIPT type = "text/JavaScript">
If (document. addeventlistener)
Document. addeventlistener ("domcontentloaded", function () {choose () ;}, null );
Else
Window. onload = choose;
</SCRIPT>

This is an event executed after the IE and FF pages are loaded.

Innertext does not have this attribute in ff. The corresponding attribute is textcontent.
The following is to determine whether it is IE

If (navigator. appname. indexof ("Explorer")>-1)
Document. getelementbyid ("XX"). innertext = "xxxxxx ";
Else
Document. getelementbyid ("XX"). textcontent = "xxxxxx ";

Innerhtml compatibility

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.