Home >Web Front-end >HTML Tutorial >javaScript creates borderless iframe compatible with ie_html/css_WEB-ITnose
3f1c4e4b6b16bbbd69b2ee476dc4f83a
var m_iframe=document.createElement("iframe");
m_iframe.scrolling="no";
m_iframe.setAttribute(" frameborder", "0", 0); //m_iframe.frameborder="0";ie7 is invalid
m_iframe.src="http://www.cnblogs.com/cssfirefly";
document .body.appendChild(m_iframe);
2cacc6d41bbb37262a98f745aa00fbf0
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])
参数:
sName
|
|||||||||||
vValue
|
Required. The variable specified for the attribute can be string, number, or Boolean type
|
||||||||||
iFlags |
Optional. The two Integer type flags specified below
|