XML DOM target event attribute
Definition and Usage
The target event attribute returns the target node of the event (the node that triggered the event), such as the element that generated the event, the document, or the window.
Syntax
event.target
Example
The following example shows how to get the element that triggered the event:
<html>
<head>
<script type="text/javascript">
function getEventTrigger(event)
{
x=event.target
;
alert("The id of the triggered element: "
+ x.id);
}
</script>
</head>
<body >
<p id="p1" onmousedown="getEventTrigger(event)">
Click on this paragraph. An alert box will
show which element triggered the event.</p>
</body>
</html>
TIY
- target အခမ်းအနား
- ဖြစ်ပေါ်လာသော အခမ်းအနား ကို ရယူရန် (IE ဘတ္တာန်ချက် က မမြောက်မွေးပါ)။