ie 两个bug(透明和absolute时,隐藏和显示子元素问题)


<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns:v="urn:schemas-microsoft-com:vml" xmlns="http://www.w3.org/1999/xhtml" dir="ltr" lang="zh-CN">
<head>
<meta http-equiv="content-type" content="text/html; charset=GB2312"/>
<style>
html,body{
height:100%;
width :100%;
}
#wrapper{
border:1px solid red;
filter:alpha(opacity=80);
position:absolute;
width:1000px;
height:300px;
/* height:1000px; */
}
#wrapper div{
background:transparent url(test.gif);
width:100px;
height:100px;
border:1px solid red;
position:absolute;
cursor:pointer;
}
</style>
<script>
function hiddenD(){
var divs = document.getElementById("wrapper").getElementsByTagName("div");
for(var i=0;i<divs.length;i++){
divs[i].style.display="none";
}
}
function showD(){
var divs = document.getElementById("wrapper").getElementsByTagName("div");
for(var i=0;i<divs.length;i++){
divs[i].style.display="";
}
}
function hiddenW(){
document.getElementById("wrapper").style.display = "none";
}
function showW(){
document.getElementById("wrapper").style.display = "";
}
</script>
</head>
<body>
<input type="button" value="隐藏wrapper" onclick="hiddenW()">
<input type="button" value="显示wrapper" onclick="showW()">
<input type="button" value="隐藏" onclick="hiddenD()">
<input type="button" value="显示" onclick="showD()">
<div id="wrapper">
<div style="top:0px"></div>
<div style="top:100px"></div>
<div style="top:200px"></div>
<div style="top:300px"></div>
<div style="top:400px"></div>
</div>
</body>
</html>


<!--
ie6和ie7类似
filter:alpha(opacity=80);时,会导致超出wrapper的部分被截断,
隐藏wrapper,再隐藏wrapper里面的div, 然后显示wrapper,发现里面的div没有隐藏,这时候再点隐藏,失效了

ie8不会截断,不隐藏wrapper的情况下点击显示和隐藏,发现没截断的部分始终会显示,其余浏览器没有此问题
-->

网名 : 天堂左我往右

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值