我是这样的 var frameObj=document.createElement("iframe");
frameObj.setAttribute("id","imb_FormModal");
document.body.appendChild(frameObj);
document.getElementById("imb_FormModal").frameborder=0;
var frameObj=document.createElement("iframe");
frameObj.setAttribute("id","imb_Background");
document.body.appendChild(frameObj);
document.getElementById("imb_Background").frameborder=0;
不知如何设置frameborder的值还有其他属性,要兼容firefox
frameObj.setAttribute("id","imb_FormModal");
document.body.appendChild(frameObj);
document.getElementById("imb_FormModal").frameborder=0;
var frameObj=document.createElement("iframe");
frameObj.setAttribute("id","imb_Background");
document.body.appendChild(frameObj);
document.getElementById("imb_Background").frameborder=0;
不知如何设置frameborder的值还有其他属性,要兼容firefox
div.innerHTML='<iframe id="imb_Background" src="" style="position:absolute;left:0;top:0;width:0px;height:0px;visibility:hidden;" frameborder="0" > </iframe > ';
document.body.appendChild(div);
首先在CSS里定义一个class
比如
.noframeborder
{
border:0;
}
然后用DOM操作,写个函数setframeborder()像你上面写的,给所有页面上的iframe添加class=“noframeborder”
然后在页面加载的时候onload更简单的就是
写setframeborder()
var iframes = document.getElementsByTagName("iframe");
for(i in iframe) -> iframe[i].setAttribute("frameborder","0");
...
然后在页面加载的时候onload
谢谢he_8134,能作到效果,希望有高人给出更好的解决方法.就此结贴了,如果能给出更好的方法,我可以再给分!
var ifr = document.createElement("iframe");
ifr.id = id;
ifr.className = "iframediv";
ifr.src = url;
ifr.width = width;
ifr.height = height;
ifr.scrolling = "no";
ifr.frameBorder=0;
ifr.allowTransparency = "true";
document.body.appendChild(ifr);
}
.iframediv{ position: fixed; display:block; top: 50%; left: 50%; margin: -290px 0 0 -200px; z-index: 202}
#iframe1{ /* ie6 hack */
_position: absolute;
_margin-top: expression(0 - parseInt(this.offsetHeight / 2) + (TBWindowMargin = document.documentElement && document.documentElement.scrollTop || document.body.scrollTop) + 'px');
}IE6+ FireFox3.0+ 下测试通过