<!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=utf-8" />
<title>获取事件的id</title>
</head>
<body>
<h4>选择列表</h4>
<div id="div1">这是一个div。
<ul>
<li id="li1">zhongguo</li>
<li id="li2">zhongguo</li>
<li id="li3">zhongguo</li>
</ul>
</div>
<p>zheshiyigeduanluo<a href="###">lianjie</a></p>
<script type="text/javascript">
document.onclick=function(){
alert(window.event.srcElement.id)
}
</script>
</body>
</html>
联系客服