<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])
参数:
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
|