<body onmouseover=mouseover()>
<input type=text name=txt1>
<input type=text name=txt2>
<script>
function mouseover()
{ alert(event.srcElement.name)
}
</script>
</body>
<input type=text name=txt1>
<input type=text name=txt2>
<script>
function mouseover()
{ alert(event.srcElement.name)
}
</script>
</body>
解决方案 »
- dojo tree问题
- 有关用js在两个页面传参数的问题~~~
- 怎么让第2个form有效....
- JSON 对象
- 如何知道原图大小,<img width=30 height=30.....这样,但很可能原图不是这个大小,如何知道原图大小?
- 如何得到this的下一个对像和上一个对像
- 为什么我的文件不能上传??
- Frame分上下二栏(topframe,downframe),如何通过topframe里的按钮刷新downfram窗口的同时自已也刷新?
- jquery中导出excel等报表文件
- 我就移动了一下项目 java就报数据库错误 大佬们帮忙看一下
- 请教各位前辈,如何在javascript中调用Word?谢谢!(在线等待中)
- 我需在HTML中调用自己写的ActiveX Dll中的函数,但是IE总会提出安全警告!
楼上这位大虾的脚本我试过了,好像对于table a 这样的对象不好
用!!
<html><head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<meta name="GENERATOR" content="Microsoft FrontPage 4.0">
<meta name="ProgId" content="FrontPage.Editor.Document">
<title>New Page 1</title>
</head><body onmouseover=mouseover()>
<input type=text name=txt1 >
<input type=text name=txt2 >
<script>
function mouseover()
{
if(window.event.clientX>txt1.offsetLeft && window.event.clientX<txt1.offsetLeft+txt1.offsetWidth && window.event.clientY>txt1.offsetTop && window.event.clientY<txt1.offsetTop+txt1.offsetHeight)
alert(event.srcElement.name)
}
</script>
</body></html>
event.clientX和event.clientY不如設一個全局變量﹐然后在onmouseover中把名稱傳給該變量var activeE=''
document.onmouseover=fucntion(){activeE=event.srcElement.name}
<table border=1 id=a1>
<tr><td><input type=text name=txt1></td>
<td><input type=text name=txt2></td></tr>
</table>
<script>
function mouseover()
{
alert(a1.contains(document.elementFromPoint(event.clientX,event.clientY)))
}
</script>
</body>