此回复为自动发出,仅用于显示而已,并无任何其他特殊作用
楼主【laton】截止到2008-06-27 11:31:23的历史汇总数据(不包括此帖):
发帖数:38 发帖分:959
结贴数:34 结贴分:870
未结数:4 未结分:89
结贴率:89.47 % 结分率:90.72 %
楼主加油
楼主【laton】截止到2008-06-27 11:31:23的历史汇总数据(不包括此帖):
发帖数:38 发帖分:959
结贴数:34 结贴分:870
未结数:4 未结分:89
结贴率:89.47 % 结分率:90.72 %
楼主加油
if(ie)
{
eventW=e.offsetX;
eventH=e.offsetY;
}
else if(ff)
{
eventW=e.clientX-e.target.offsetLeft;//target事件触发的对象
eventH=e.clientY-e.target.offsetTop;
}
我以前这么办的
你的错误是什么呢?
var y = event.offsetY+10; 提示: 错误,缺少对象。
好像是 event.offsetX 出问题,可能是由ocx无法接收event事件
var y = e.offsetY;
alert(x);这样alert出来的是 "undefined" ,不是数字啊
{
e=e||event;
alert(e.clientX+","+e.clientY);
}document.onclick=function(event){test(event);};
如果是ie的话
var e= window.event;
eventW=e.offsetX;
eventH=e.offsetY;
你alert(e)看看可以么?
zwl0219 var e= window.event;
alert(e); alert(e)为"null"
<head runat="server">
<title>无标题页</title>
<script>
function move(){
document.getElementById('x').value = window.event.clientX + document.body.scrollLeft - document.body.clientLeft;
document.getElementById('y').value = window.event.clientY + document.body.scrollTop - document.body.clientTop;
}
document.onmousemove = move;
</script>
</head>
<body>
<form id="form1" runat="server">
<div>
<input id="x" type="text" />
<input id="y" type="text" /></div>
</form>
</body>
</html>
ie only
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title>去吃饭了</title>
</head><body>
<div style=" width:200px; height:300px; background:#CCCC66" onclick="ck()">在此区域中单击察看效果!我这里正常</div>
<script language="javascript">
function ck()
{
var e= window.event;
eventW=e.offsetX;
eventH=e.offsetY;
alert(e)
alert(eventW)
}</script>
</body>
</html>
{
e=e || event;
alert(e.clientX+","+e.clientY);
}document.onclick=function(event){test(event);};咦~~~之前的代码被编码了。。
zwl0219
我知道div捕获的鼠标事件是可以的。
但是activeX控件所在区域无法检测
<!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=gb2312" />
<title>去吃饭了 </title>
</head> <body>
<div style=" width:200px; height:300px; background:#CCCC66" onclick="ck()">在此区域中单击察看效果!我这里正常
<OBJECT id="obj1" classid=CLSID:C3938931-256A-42FA-83C1-C30CDB237A8D class="obj"></OBJECT>
</div>
<script language="javascript">
function ck()
{
var e= window.event;
eventW=e.offsetX;
eventH=e.offsetY;
alert(e)
alert(eventW)
} </script>
</body>
</html>
可以看看:http://www.mvps.org/vcfaq/com/1.htm
然后再弹出菜单
id="Server"
classid="clsid:XXXXXXXXXXXXXXXXXXXXXXXXXXXX"
>
</OBJECT>
<SCRIPT LANGUAGE="JavaScript" for="Server" event="OnConnect">
<!--
//这样就可以触发到方法了,但是只对应一个事件!
//-->
</SCRIPT>