62,254
社区成员
发帖
与我相关
我的任务
分享
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title>无标题页</title>
<style type="text/css">
html,body {height:100%; margin:0px; font-size:12px;}
.mydiv
{
background-color: #FFCC66;
border: 1px solid #FFOOOO;
text-align: center;
line-height: 40px;
font-size: 12px;
font-weight: bold;
z-index:999;
left:50%;
top:50%;
position:fixed!important;/* FF IE7*/
position:absolute;/*IE6*/
_top: expression(eval(document.compatMode &&
document.compatMode=='CSS1Compat') ?
documentElement.scrollTop + (document.documentElement.clientHeight-this.offsetHeight)/2 :/*IE6*/
document.body.scrollTop + (document.body.clientHeight - this.clientHeight)/2);/*IE5 IE5.5*/
}
.bg,.popIframe
{
background-color: #666;
display:none;
width: 100%;
height: 100%;
left:0;
top:0;/*FF IE7*/
filter:alpha(opacity=50);/*IE*/
opacity:0.5;/*FF*/
z-index:1;
position:fixed!important;/*FF IE7*/
position:absolute;/*IE6*/
_top: expression(eval(document.compatMode &&
document.compatMode=='CSS1Compat') ?
documentElement.scrollTop + (document.documentElement.clientHeight-this.offsetHeight)/2 :/*IE6*/
document.body.scrollTop + (document.body.clientHeight - this.clientHeight)/2);/*IE5 IE5.5*/
}
.popIframe {
filter:alpha(opacity=0);/*IE*/
opacity:0;/*FF*/
}
</style>
<script language="javascript" type="text/javascript">
function showDiv(divName,intWidth,intHeight)
{
var newDiv=document.getElementById(divName);
newDiv.style.width=intWidth+'px';
newDiv.style.height=intHeight+'px';
newDiv.style.marginLeft=intWidth/2*-1+'px';
newDiv.style.marginTop=intHeight/2*-1+'px';
document.getElementById(divName).style.display='block';
var newFrame=document.createElement("iframe"); //这段是我改的,原来是在html中定义的改为在js中生成后ff的遮罩没不能显示了。
newFrame.id="popIframe";
newFrame.frameborder="0";
newFrame.className='popIframe';
document.appendChild(newFrame);
document.getElementById('popIframe').style.display='block';
document.getElementById('bg').style.display='block';
}
function closeDiv(divName)
{
document.getElementById(divName).style.display='none';
document.getElementById('bg').style.display='none';
document.getElementById('popIframe').style.display='none';
}
</script>
</head>
<body>
<form id="form1" runat="server">
<div id="popDiv" class="mydiv" style="display:none;">这是弹出式的窗口<br/>
<a href="javascript:closeDiv('popDiv')">关闭</a></div>
<div id="bg" class="bg" style="display:none;"></div>
<a href="javascript:showDiv('popDiv',500,100)">弹出</a>
<%--<iframe id='popIframe' class='popIframe' frameborder='0' ></iframe>--%>
//这里是原来的做法,Iframe在这里定义的话在FF中显示就正常了!
</form>
</body>
</html>