关于事件源IE 与火狐的不同
1<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
2<html xmlns="http://www.w3.org/1999/xhtml" >
3<head>
4 <title>无标题页</title>
5
6 <script language="javascript" type="text/javascript">
7 window.onload=initAll;
8
9 function initAll()
10 {
11 document.getElementById("firefox").onclick=show;
12 return false;
13 }
14
15 function show(evt)
16 {
17 if(evt)
18 {
19 alert(evt.target.parentNode.tagName);
20 return false;
21 }
22 else
23 {
24 alert(event.srcElement.parentNode.tagName);
25 }
26 return false;
27 }
28 </script>
29
30</head>
31<body>
32<a href="HTMLPage_1.htm" id="firefox"><img src="1.gif" /></a>
33</body>
34</html>
35
2<html xmlns="http://www.w3.org/1999/xhtml" >
3<head>
4 <title>无标题页</title>
5
6 <script language="javascript" type="text/javascript">
7 window.onload=initAll;
8
9 function initAll()
10 {
11 document.getElementById("firefox").onclick=show;
12 return false;
13 }
14
15 function show(evt)
16 {
17 if(evt)
18 {
19 alert(evt.target.parentNode.tagName);
20 return false;
21 }
22 else
23 {
24 alert(event.srcElement.parentNode.tagName);
25 }
26 return false;
27 }
28 </script>
29
30</head>
31<body>
32<a href="HTMLPage_1.htm" id="firefox"><img src="1.gif" /></a>
33</body>
34</html>
35