view Event Property - Javascript DOM

Javascript examples for DOM:Event

Description

The view event property returns the Window object where the event occured.

Return Value

A String, representing the type of the event

The following code shows how to get the event view:

Demo Code

ResultView the demo in separate window

<!DOCTYPE html>
<html>
<body>

<p>Click the button to get the event view.</p>

<button onclick="myFunction(event)">Test</button>

<p id="demo"></p>

<script>
function myFunction(event) {/* ww  w. j  av  a 2  s .  co m*/
    var x = event.view;
    document.getElementById("demo").innerHTML = x;
}
</script>

</body>
</html>

Related Tutorials