Home  >  Article  >  Web Front-end  >  javaScript创建无边框iframe兼容ie_html/css_WEB-ITnose

javaScript创建无边框iframe兼容ie_html/css_WEB-ITnose

WBOY
WBOYOriginal
2016-06-24 12:34:07965browse

<script><br />var m_iframe=document.createElement("iframe");<br />m_iframe.scrolling="no";</script>

m_iframe.setAttribute("frameborder", "0", 0);  //m_iframe.frameborder="0";ie7无效

m_iframe.src="http://www.cnblogs.com/cssfirefly";
document.body.appendChild(m_iframe);

注意:

m_iframe.frameborder="0"; 替换为m_iframe.setAttribute("frameborder", "0", 0);就可以了

 

IE7下动态创建Iframe时,在IE里面的属性有大小写区分,所以frameBorder与frameborder是不同属性

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

this.frame.setAttribute("frameborder", "0", 0);后面那个'0'表示忽略大小写。

 

setAttribute:

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

 


Statement:
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