层的透明显示 怎么才能让层透明显示并且鼠标选不了层下面的内容并且能随滚动条的滚动层自动增加高度实现层遮住层下内容求代码 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 是要这样的效果么<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"><html> <head> <title> 测试 </title> <style> body{margin:0;} .none{display:none;} .bg{width:100%; height:100%; top:0px; left:0px; margin:0; background:Green; position:absolute; z-index:1000;filter:alpha(opacity=5);opacity: 0.5;-moz-opacity: 0.5;} .content{clear:both; margin-top:200px; text-align:center;} </style> </head> <body> <div class="bg none" id="bgID"></div> <input type="button" onclick="tranLayout.blockOrNone(1)" value="click me" /> <div class="content">content</div> <div class="content">content</div> <div class="content">content</div> <div class="content">content</div> <div class="content">content</div> <div class="content">content</div> <div class="content">content</div> <div class="content">content</div> <div class="content">content</div> <script type="text/javascript"> var tranLayout={ target:document.getElementById("bgID"), blockOrNone:function(flag){ if(flag==1){ tranLayout.target.className="bg"; } else{ tranLayout.target.className="bg none"; } }, SetHeight:function(){ tranLayout.target.style.height=document.body.offsetHeight+"px"; } }; tranLayout.SetHeight(); </script> </body></html> 非常优秀,ff/chrome/ie通过,opera失败…… <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"><html> <head> <title> demo </title> <script language="javascript" src="jQuery/jquery-1.4.2.min.js"></script> <script language="javascript" type="text/javascript"> $(document).ready(function () { $("#<%= this.btndiv.ClientID %>").click(function () { $("#<%= this.loading.ClientID %>").show(); }); }) </script> <style type="text/css"> /*加载条*/ div.loading_1 { background-image: url(Images/loading_mid.gif); background-position: center center; background-repeat: no-repeat; margin-top: 20%; height: 32px; } /*透明遮盖层*/ div.overlay { background-color: #ffffff; opacity: .70; filter: Alpha(Opacity=70); position: absolute; top: 0; left: 0; width: 100%; height: 100%; z-index: 0; } </style> </head><body style="font-size: small"><form id="form1" runat="server"> <div><input id="btndiv" type="button" value="遮罩" runat="server" /></div><div id="loading" class="overlay" style="display: none;" runat="server"> <div class="loading_1"> </div> </div> <!--纠正进度条高度兼容多浏览器--> <script language="javascript" type="text/javascript"> $('#loading').height($(document.body).height());</script></form>有用了jquery 需要引用Jquery的包 JQuery中关于自动生成HTML语句和完成替换的疑问。 javascript一个正则表达式问题 在不用鼠标的情况下,用Tab键移动光标到第二个文本框。怎样才能在有光标的文本框中出现提示呢? 如何用javascript取得这个值 关于使用键盘的方向键移动网页上一个无素的问题 javascript日历 Netscape被活埋-墓志铭上写着7月15日 各位大侠谁能解决这个问题? 如何对iframe内的document中的元素设值 求教——关于vue的watch监听事件 jquery的几个问题。 jQuery--有更简单的代码的吗?
<html>
<head>
<title> 测试 </title>
<style>
body{margin:0;}
.none{display:none;}
.bg{width:100%; height:100%; top:0px; left:0px; margin:0; background:Green; position:absolute; z-index:1000;filter:alpha(opacity=5);opacity: 0.5;-moz-opacity: 0.5;}
.content{clear:both; margin-top:200px; text-align:center;}
</style>
</head> <body>
<div class="bg none" id="bgID"></div>
<input type="button" onclick="tranLayout.blockOrNone(1)" value="click me" />
<div class="content">content</div>
<div class="content">content</div>
<div class="content">content</div>
<div class="content">content</div>
<div class="content">content</div>
<div class="content">content</div>
<div class="content">content</div>
<div class="content">content</div>
<div class="content">content</div>
<script type="text/javascript">
var tranLayout={
target:document.getElementById("bgID"),
blockOrNone:function(flag){
if(flag==1){
tranLayout.target.className="bg";
}
else{
tranLayout.target.className="bg none";
}
},
SetHeight:function(){
tranLayout.target.style.height=document.body.offsetHeight+"px";
}
};
tranLayout.SetHeight();
</script>
</body>
</html>
非常优秀,ff/chrome/ie通过,opera失败……
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<title> demo </title>
<script language="javascript" src="jQuery/jquery-1.4.2.min.js"></script>
<script language="javascript" type="text/javascript">
$(document).ready(function () {
$("#<%= this.btndiv.ClientID %>").click(function () {
$("#<%= this.loading.ClientID %>").show();
});
})
</script>
<style type="text/css">
/*加载条*/
div.loading_1
{
background-image: url(Images/loading_mid.gif);
background-position: center center;
background-repeat: no-repeat;
margin-top: 20%;
height: 32px;
}
/*透明遮盖层*/
div.overlay
{
background-color: #ffffff;
opacity: .70;
filter: Alpha(Opacity=70);
position: absolute;
top: 0;
left: 0;
width: 100%;
height: 100%;
z-index: 0;
}
</style>
</head>
<body style="font-size: small">
<form id="form1" runat="server">
<div><input id="btndiv" type="button" value="遮罩" runat="server" /></div>
<div id="loading" class="overlay" style="display: none;" runat="server">
<div class="loading_1">
</div>
</div>
<!--纠正进度条高度兼容多浏览器-->
<script language="javascript" type="text/javascript"> $('#loading').height($(document.body).height());</script>
</form>
有用了jquery 需要引用Jquery的包