JavaScript even...LOGIN

JavaScript event source

The event source exists as a property of the event object. In the W3C specification, this attribute is target; however, IE8.0 and below does not support this attribute, and it uses the srcElement attribute to obtain the event source.

Get the event source.

<html>
<head>
<title>获取事件源</title>
</head>
<body>
<div id="demo">点击这里</div>
<script type="text/javascript">
    document.getElementById("demo").onclick=function(e){
        var eve = e || window.event;
        var srcNode = eve.target || eve.srcElement;  // 兼容所有浏览器
        alert(srcNode);
    }
</script>
</body>
</html>



Next Section
1
2
<html>
<head>
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
submitReset Code
ChapterCourseware