CSS中透明度filter: Alpha(Opacity= 再iframe中再次使用出错
有个index页面,里面有个iframe. 其中index页面设置iframe的透明度为85,在iframe中有个进度条也有设置一个层的透明度,但是运行后出现层级混乱,去掉index的85透明度,运行正常,但是必须使用85透明度,下面是2个html代码,大家都来看看怎么修改才会在85的透明度下正常
将2个代码复制进去,运行index.html既能看见效果
方便大家调试,把代码附上,纯html
index.html代码
iframe.html代码
将2个代码复制进去,运行index.html既能看见效果
方便大家调试,把代码附上,纯html
index.html代码
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title>无标题文档</title>
<style>
body{background-color:#3399CC;}
.iframe{filter: Alpha(Opacity=85)}
</style>
</head>
<body>
<iframe src="iframe.html" width="100%" height="600px" frameBorder="0" class="iframe" scrolling="no" ></iframe>
</body>
</html>
iframe.html代码
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title>无标题文档</title>
<style>
body{ background-color: transparent;}
.mydiv
{
font-weight: bold;
z-index: 9;
left: 45%;
top: 48%;
margin-left: -150px!importnt; /*FF IE7 该值为本身宽的a一半 */
margin-top: -60px !important; /*FF IE7 该值为本身高的一半*/
margin-top: 0px;
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: #CCCCCC;
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);
}
.popIframe
{
filter: alpha(opacity=0); /*IE*/
opacity: 0; /*FF*/
}
</style>
<script>
function showDiv() {
document.getElementById('popDiv').style.display = 'block';
document.getElementById('popIframe').style.display = 'block';
document.getElementById('bg').style.display = 'block';
}
function closeDiv() {
document.getElementById('popDiv').style.display = 'none';
document.getElementById('bg').style.display = 'none';
document.getElementById('popIframe').style.display = 'none';
}
</script>
</head>
<body>
<input type="button" onclick="showDiv()" value="点击进入进度" />
<div id="popDiv" class="mydiv" style="display:none;">
<img src="http://www.23ps.com/Files/UpLoadFile/201106/201106091504386485.gif" />
</div>
<div id="bg" class="bg" style="display:none;"></div>
<iframe id='popIframe' class='popIframe' frameborder='0' ></iframe>
</body>
</html>
...全文
相关推荐
js实现拉伸拖动iframe的具体代码
介绍了js实现拉伸拖动iframe的具体代码,有需要的朋友可以参考一下
用js+iframe形成页面的一种遮罩效果的具体实现
用js形成页面的一种遮罩效果,选择想要进行遮罩的窗口,在这里想要遮罩的是一个iframe窗口,具体的实现如下,感兴趣的朋友可以参参考下
HTML中iFrame标签的两个用法介绍
主要介绍了HTML中iFrame标签的两个用法,分别是作为弹出层铺底覆盖,和跨域写入cookie,需要的朋友可以参考下
iframe子页面操作父页面并实现屏蔽页面弹出层效果
本文为大家详细介绍下iframe子页面操作父页面实现屏蔽整个页面并弹出要显示的层,下面有个不错的示例大家可以参考下
在浏览器窗口上添加遮罩层的方法
在web2.0中,页面弹窗是一个很常见的交互方式,这样既可以避免不必要的页面跳转,也可以改进界面的布局和可交互性


