Home > Web Front-end > HTML Tutorial > javaScript creates borderless iframe compatible with ie_html/css_WEB-ITnose

javaScript creates borderless iframe compatible with ie_html/css_WEB-ITnose

WBOY
Release: 2016-06-24 12:34:07
Original
1007 people have browsed it

<script><br>var m_iframe=document.createElement("iframe");<br>m_iframe.scrolling="no";</p> <p>m_iframe.setAttribute(" frameborder", "0", 0); //m_iframe.frameborder="0";ie7 is invalid</p> <p>m_iframe.src="http://www.cnblogs.com/cssfirefly";<br>document .body.appendChild(m_iframe);</p> <p></script>

Note:

m_iframe.frameborder="0"; Replace with m_iframe.setAttribute("frameborder" , "0", 0); that's it

When dynamically creating an Iframe under IE7, the attributes in IE are case-sensitive, so frameBorder and frameborder are different attributes

this.frame.setAttribute("frameborder", "0", 0);

this.frame.setAttribute("frameborder", "0", 0); The '0' at the end means that case is ignored.

setAttribute:

object.setAttribute(sName, vValue [, iFlags]) 
Copy after login
 参数: 
Copy after login
sName
sName 必填项. String类型,属性名
vValue 必填项. 为属性指定的变量,可以为string, number, 或者 Boolean类型
iFlags 选填. 下面指定的两种 Integer 类型的标志
0 覆盖同名属性.
1 默认值. 为属性添加指定的值.
Required. String type, attribute name
vValue

Required. The variable specified for the attribute can be string, number, or Boolean type

iFlags
Optional. The two Integer type flags specified below 1
0 override the properties of the same name.
Default value. Add the specified value to the attribute.
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template