参考网上文章 http://hi.baidu.com/suofang/blog/item/72f2f7ed23f2324e78f055c4.html 写的一个函数
/**/ /**
* 让iframe 显示在 指定的div下面 针对ie6 select挡住div 的bug 采用 iframe来当作div的底
*
* @param string divId 需要解决的div层
* @param string iframeId 采用的 IFRAME ,如果不指定 自动生成一个
* 2007-11-1 gggxin@hotmail.com
* @version 1.0.0
*/
function topDiv(divId,iframeId)
... {
var div_dom = document.getElementById(divId);
!iframeId && (iframeId = 'Hide4Ie6Buga'); //默认 iframe 的 id
var iframe_dom = document.getElementById(iframeId);
if(!iframe_dom) //不存在 自动生成 iframe
...{
var tmpIframeDom = document.createElement("IFRAME");
tmpIframeDom.id = iframeId;
document.body.appendChild(tmpIframeDom);
iframe_dom = document.getElementById(iframeId);
iframe_dom.src = "about:blank"; //javascript:void(0); about:blank
iframe_dom.style.display = "block";//none
iframe_dom.style.position = "absolute";
iframe_dom.style.scrolling = "no";
iframe_dom.style.frameBorder = 0;
// iframe_dom.style.backgroundColor = "#ff0000";
// iframe_dom.setAttribute("style","position:absolute; top:0px; left:0px; "); //display:none;
}
//使iframe 处于 指定的 div 下面
iframe_dom.style.width = div_dom.offsetWidth;
iframe_dom.style.height = div_dom.offsetHeight;
iframe_dom.style.top = div_dom.style.top;
iframe_dom.style.left = div_dom.style.left;
iframe_dom.style.zIndex = div_dom.style.zIndex - 1;
// iframe_dom.style.display = "block";
}