层罩的CSS设置
自己改写了网上拷贝的层罩代码,用后发现当有滚动条的时候,层罩能盖住整个页面,而当页面的内容只有几行的时候(如页面高的1/3)层罩只能盖住有内容的部分,不能盖住整个页面(层罩背景色不一样,很难看),该怎样处理?这些代码是不是所有的浏览器都有效?。————————————————————————————————————————
.divCover
{
filter: alpha(opacity=30);
-moz-opacity: 0.3;
opacity: 0.3;
background-color: #000;
width: 100%;
height: 100%;
z-index: 1000;
position: absolute;
left: 0;
top: 0;
overflow: hidden;
}
function objDisplay(objId,value){
document.getElementById(objId).style.display = value ;
}
function $(id) {
return (document.getElementById) ? document.getElementById(id) : document.all[id];
}
function showDivCover(divCover) {
var range = getRange();
$(divCover).style.width = range.width + "px";
$(divCover).style.height = range.height + "px";
$(divCover).style.display = "block";
}
function getRange() {
var top = document.body.scrollTop;
var left = document.body.scrollLeft;
var height = document.body.clientHeight;
var width = document.body.clientWidth;
if (top == 0 && left == 0 && height == 0 && width == 0) {
top = document.documentElement.scrollTop;
left = document.documentElement.scrollLeft;
height = document.documentElement.clientHeight;
width = document.documentElement.clientWidth;
}
return { top: top, left: left, height: height, width: width };
}
<div id="divCover" style="display: none;" class="divCover" /> --------------------编程问答--------------------
top = document.documentElement.scrollTop;
left = document.documentElement.scrollLeft;
var Width = document.body.offsetWidth+'px';
var sClientHeight = document.body.offsetHeight;
var sScrollTop = document.body.scrollTop+document.documentElement.scrollTop;
height=(sClientHeight + sScrollTop) + "px";
return{ top: top, left: left, height: height, width: width };
补充:.NET技术 , ASP.NET