Solve the differences between iframe's frameborder in chrome/ff/ie _ javascript skills

Source: Internet
Author: User
Recently, the js method for dynamically creating iframe was used in the project. It was found that iframe. frameborder & quot; 0 & quot; does not work in IE7, while chromeff is normal and depressing. The Code is as follows:


Var iframe = document. createElement ("iframe ");
Iframe. id = "frame-" + index;
Iframe. src = url;
Iframe. width = "100% ";
Iframe. marginwidth = "0 ";
Iframe. scrolling = "no ";
Iframe. frameborder = "0 ";


Use "view source code of the selected Region" in IE to find that the created iframe code is I searched the information online. It turns out that IE does not recognize lowercase letters. I am dizzy .... <br> use <BR> <p class = "codetitle"> <U> </U> the code is as follows: </p> <p class = "codebody" id = "code87544"> <BR> setAttribute ("frameborder", "0", 0 ); <BR> // The problem is fixed. <BR> </p> <br> <p class = "codetitle"> <U> </U> the code is as follows: </p> <p class = "codebody" id = "code65518"> <BR> var iframe = document. createElement ("iframe"); <BR> iframe. id = "frame-" + index; <BR> iframe. src = url; <BR> iframe. width = "100%"; <BR> iframe. marginwidth = "0"; <BR> iframe. scrolling = "no"; <BR> iframe. setAttribute ("frameborder", "0", 0); // The Last 0 indicates whether the case is different. The problem is solved.

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.