Div 弹出屏幕居中

JS控制id 为"divv"的层在屏幕中间

function show(){

  var width=document.getElementById("divv").style.width;

  var height=document.getElementById("divv").style.height;

  with(document.getElementById("divl").style){  
          left = (window.screen.width-width)/2+document.documentElement.scrollLeft;
          top  = (window.screen.height-height)/2+document.documentElement.scrollTop;

          position='absolute'
          zIndex = 1001
      }  

  document.getElementById("divv").style.display = "block";

}

posted @ 2010-01-19 14:27  TQ.CH  阅读(610)  评论(0编辑  收藏  举报