Skip to content
Related Articles

Related Articles

Improve Article

SVG Window.event Property

  • Last Updated : 16 Nov, 2020

The SVG Window.event property returns the event which is currently being handled by the site’s code.

Syntax:

var e = window.event

Return value: This property returns the Event which is currently being handled by the site’s code.

Example 1: In this example we will use onclick event.

HTML




<!DOCTYPE html>
<html>
  
<body>
    <center>
        <h1>GeeksforGeeks</h1>
  
        <button onclick="get()">
            Get event
        </button>
          
        <br><br>
        <div id="g"></div>
  
        <svg viewBox="0 0 1000 1000" 
            xmlns="http://www.w3.org/2000/svg">
              
            <script type="text/javascript">
                function get() {
                    console.log(window.event);
                }
            </script>
        </svg>
    </center>
</body>
  
</html>

Output:



Example 2: In this example, we will use onmouseover event.

HTML




<!DOCTYPE html>
<html>
  
<body>
    <center>
        <h1>GeeksforGeeks</h1>
          
        <button onmouseover="get()">
            Get event
        </button>
          
        <br><br>
        <div id="g"></div>
  
        <svg viewBox="0 0 1000 1000" 
            xmlns="http://www.w3.org/2000/svg">
              
            <script type="text/javascript">
                function get() {
                    console.log(window.event);
                }
            </script>
        </svg>
    </center>
</body>
  
</html>

Output:

 

Attention reader! Don’t stop learning now. Get hold of all the important HTML concepts with the Web Design for Beginners | HTML  course.




My Personal Notes arrow_drop_up
Recommended Articles
Page :