用div控制其位置
通过screen对象的width和heigth来得到显示器分辨率,然后documentElement.clientWidth还有窗口的位置来确定 真正显示的位置

解决方案 »

  1.   

    http://code.seolm.com/cc/Code_Img/20060309/01/
      

  2.   

    <body style="margin:0px">
    <div style="height:1500px"><img src="http://images.csdn.net/upimgs/CSDN-ad120_360.GIF" width="20" height="60" style="cursor:hand" onclick="display()" /></div><div id="gray" style="position:absolute;width:10px;height:10px;filter:alpha(opacity=35);background-color:black;display:none;z-index:8"></div>
    <div id="showbox" style="display:none;position:absolute;z-index:9"><img src="http://images.csdn.net/upimgs/CSDN-ad120_360.GIF" width="120" height="360" /></div>
    <script>
    function display()
    {
    var mask=document.getElementById("gray");
    var showbox=document.getElementById("showbox");
    mask.style.pixelTop=0;
    mask.style.pixelLeft=0;
    mask.style.width=document.body.clientWidth;
    mask.style.height=document.body.clientHeight;
    mask.style.display="";
    showbox.style.pixelLeft=Math.floor((document.body.clientWidth-120)/2);
    showbox.style.pixelTop=Math.floor((document.body.clientHeight-360)/2);
    showbox.style.display="";
    }
    </script>
    </body>