<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb18030" />
<title>Untitled Document</title>
</head>
<script>
function show()
{
var obj = document.getElementById("a")
obj.style.display="block";
obj.style.pixelTop = event.clientY;
obj.style.pixelLeft = event.clientX;
}
document.onmousedown = show;
</script>
<body>
<div id="a" style=" position:absolute;background:#CCCCCC; width:300px; height:200px; display:none;"></div>
</body>
</html>
当点击到窗口的右边缘时,屏幕会敞开.且出现滚动条.如何解决这个问题啊?
在线等.........

解决方案 »

  1.   

    给body加个overflow:hidden 就截断了,没有滚动了这个问题你在边缘点击的时候把宽度给撑大了吧.
      

  2.   

    给body加个overflow:hidden 还是和原来一样。没有作用啊还是候把宽度给撑大了
      

  3.   

    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> 
    <html xmlns="http://www.w3.org/1999/xhtml"> 
    <head> 
    <meta http-equiv="Content-Type" content="text/html; charset=gb18030" /> 
    <title>Untitled Document </title> 
    </head> 
    <script> 
    function show() 

    var obj = document.getElementById("a") 
    obj.style.display="block"; 
    obj.style.pixelTop = (document.documentElement.clientHeight-event.clientY<200)?(document.documentElement.clientHeight-200):event.clientY; 
    obj.style.pixelLeft = (document.documentElement.clientWidth-event.clientX<300)?(document.documentElement.clientWidth-300):event.clientX; 

    document.onmousedown = show; 
    </script> 
    <body> 
    <div id="a" style=" position:absolute;background:#CCCCCC; width:300px; height:200px; display:none;"> </div> 
    </body> 
    </html> 
      

  4.   

    先要兼容event。 这个网上很多。 我就不说了 IE下是document.documentElement.clientWidth;
    FF得写self.innerWidth然后 浮动控制left可能也要注意一下
      

  5.   

    天上群星朝北斗,天下自古真情有,想思之苦织女情,你瞧牛郎多憨厚。http://www.qihao123.com/ 时传梁祝痴情留,时有翁帆牵杨手,念念难忘情似海,你我真爱到永久! 
    梦你,用美美的夜;看你,用痴痴的眼;疼你,用满满的爱;抱你, http://www.5566.hi.cn/ 用暖暖的怀;亲你,用甜甜的嘴;想你,用空空的心;爱你,用永远的情!