Remove borders when dynamically creating IFRAME in IE7

Source: Internet
Author: User
When creating an IFRAME dynamically in IE7, remove the border

As we all know, as long as you set the IFRAME attribute: frameborder = "0", IFRAME does not display the border, but when you use the following method, it seems that this attribute does not work:

JS Code
    1. This. Frame = Document. createelement ("Iframe");
    2. ...
    3. This. Frame. setattribute ("Frameborder","0");
    4. ...

 

Ifram still shows the border. Why? If you check Dom inspector, you will find that all attributes in Dom are in uppercase under IE, that is, the above Code, in IE, it will eventually become:

JS Code

    1. <IFRAME frameborder = 0...

Because IE is capitalized, it does not recognize "frameborder.

Now that you know why, you can solve the problem and change the code:

JS Code

    1. This. Frame = Document. createelement ("Iframe");
    2. ...
    3. This. Frame. setattribute ("Frameborder","0",0);
    4. ...

This. Frame. setattribute ("Frameborder","0",0); The '0' next to it indicates whether it is case sensitive.

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.