如何獲取事件觸發源(兼容IE和FireFox和gooogle)~(小例子)
Posted on 2008-09-24 15:12 魚躍于淵 閱讀(200) 評論(0) 編輯 收藏 所屬分類: javascript相關<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Insert title here</title>
<script type="text/javascript">
window.onload=initAll ;
function initAll(){
document.getElementById("test01").onclick=test ;
}
function test(evt){
var src = evt ? evt.target : window.event.srcElement ;
alert(src) ;
return false ;
}
</script>
</head>
<body>
<center>
<a id="test01">test01</a>
</center>
</body>
</html>