案例:javascript案例     状态:可编辑再运行    进入竖版
 运行结果 
x
 
1
<html>
2
<head>
3
4
<script type="text/javascript">
5
function getEventTrigger(event)
6
  { 
7
  x=event.target; 
8
  alert("The id of the triggered element: " + x.id);
9
  }
10
</script>
11
</head>
12
13
<body >
14
15
<p id="p1" onmousedown="getEventTrigger(event)">
16
Click on this paragraph. An alert box will show which element triggered the event.</p>
17
18
</body>
19
</html>
20