把分页放在页面正中

<html>
<head>
<script type="text/javascript" language="javascript">
function resizeFrame(){
    var vH=document.getElementById("middle").offsetHeight;
    var y=(parseInt(document.documentElement.clientHeight)-vH)/2;
    var vW=document.getElementById("middle").offsetWidth;
    var x=(parseInt(document.documentElement.clientWidth)-vW)/2;
    document.getElementById("middle").setAttribute("style", "margin-top:"+y+"px;margin-left:"+x+"px;");
}
window.onresize=resizeFrame;
window.onload=resizeFrame;
</script>
</head> 
<body > 
<div id="middle" style="position:absolute;">
文字居中显示!<br/>
文字居中显示!<br/>
文字居中显示!<br/>
</div>
</html>
posted on 2014-05-29 09:34  _故乡的原风景  阅读(137)  评论(0编辑  收藏  举报