JavaScript Reference/Javascript Properties/target event

Материал из Web эксперт
Перейти к: навигация, поиск

"target" Example

    
<html>
<body>
<script>
function function1(myEvent) { 
   document.getElementById("myX").innerHTML = myEvent.layerX;
   document.getElementById("myY").innerHTML = myEvent.layerY; 
} 
document.onmousemove = function1;
</script>
<p>
<b>Layer X:</b> 
<span id="myX">0</span>
</p>
<p>
<b>Layer Y:</b> 
<span id="myY">0</span>
</p>
<button onclick="alert(event.type);">Event Type</button>
</body>
</html>



"target" is applied to

+----------------+--------------------------------------------------------------+
| Applied_To     |event                                                         |
+----------------+--------------------------------------------------------------+



"target" Syntax and Note

Note:
Read-only property. 
Returns the event target object name.
    
Syntax:
    
event.target
eventName.target