<html>
<head>
<script type="text/javascript">
function whichElement(e)
{
var targ
if (!e) var e = window.event
if (e.target) targ = e.target
else if (e.srcElement) targ = e.srcElement
if (targ.nodeType == 3) // defeat Safari bug
targ = targ.parentNode
var tname
tname=targ.tagName
alert("You clicked on a " + tname + " element.")
}
</script>
</head>
<body οnmοusedοwn="whichElement(event)">
<p>在文档中点击某个位置。消息框会提示出您所点击的标签的名称。</p>
<h3>这是标题</h3>
<p>这是段落。</p>
<img src="../i/eg_mouse2.jpg" />
</body>
</html>
期待解决:
要实现的功能:鼠标放到哪个位置,哪个位置字体变红。
========================================
javabean flag 标记法???
标签:target,对象,targ,srcElement,var,点击,应用,tname,Event
From: https://blog.51cto.com/u_16179085/6663484