首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 开发语言 > 编程 >

将DIV展示在屏幕中间

2012-10-30 
将DIV显示在屏幕中间/*设置客户端的高和宽*/function getClientBounds(){var clientWidthvar clientHeigh

将DIV显示在屏幕中间

/*设置客户端的高和宽*/function getClientBounds(){    var clientWidth;    var clientHeight;        clientWidth = document.compatMode == "CSS1Compat" ? document.documentElement.clientWidth : document.body.clientWidth;    clientHeight = document.compatMode == "CSS1Compat" ? document.documentElement.clientHeight :   document.body.clientHeight;            return {width: clientWidth, height: clientHeight};}
?
/*设置客户端的高和宽*/  function divcenter(){         var divId=document.getElementById('mxh');        var rr=new getClientBounds();      divId.style.display='block';      divId.style.left=(rr.width-divId.clientWidth)/2+document.body.scrollLeft;      divId.style.top=(rr.height-divId.clientHeight)/2+document.body.scrollTop;     }  
?

热点排行