<!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>
当点击到窗口的右边缘时,屏幕会敞开.且出现滚动条.如何解决这个问题啊?
在线等.........
<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>
当点击到窗口的右边缘时,屏幕会敞开.且出现滚动条.如何解决这个问题啊?
在线等.........
<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>
FF得写self.innerWidth然后 浮动控制left可能也要注意一下
梦你,用美美的夜;看你,用痴痴的眼;疼你,用满满的爱;抱你, http://www.5566.hi.cn/ 用暖暖的怀;亲你,用甜甜的嘴;想你,用空空的心;爱你,用永远的情!