我的高度不对好像只有8px,这是为什么呀?
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>jQuery Validation 插件</title>
<link rel="stylesheet" href=""/>
<style type="text/css">
#mask{
background: #000;
opacity:0.75;
/*解决ie不兼容*/
filter:alpha(opacity=75);
height: 1000px;
width: 100%;
position: absolute;
left:0;
top:0;
z-index: 1000;
}
#login{
position: fixed;
left: 30%;
top:30%;
z-index: 1001;
}
.logincon{
width: 670px;
height: 380px;
background: url(img/loginBg.png)no-repeat;
position: relative;
}
#close{
width: 30px;
height: 30px;
background: url(img/close.png) no-repeat;
cursor:pointer;
position: absolute;
right: 0;
top: 0;
}
</style>
</head>
<!---->
<!--<body>
<dvi id="mask"></dvi>覆盖层
<dvi id="login">
<div>
<div id="close"></div>
</div>
</dvi>内容层 -->
<script type="text/javascript" >
window.onload = function(){
var oBtn = document.getElementById("btnLogin");//创建元素节点再生成
//获取页面的高度和宽度
var sHeight = document.documentElement.scrollHeight;
var sWidth = document.documentElement.scrollWidth;
var oMask = document.createElement("div")//创建一个div,下面再给它一个id
oMask.id="mask";
oMask.style.height=sHeight + 'PX';
oMask.style.width=sWidth + 'PX';
document.body.appendChild(oMask);//在页面追加一个节点
}
</script>
</body>
</html>