Skip to content
Related Articles

Related Articles

Improve Article

SVG Window.document Property

  • Last Updated : 16 Nov, 2020

The SVG Window.document property returns a reference to the document contained in the window.

Syntax:

var object = window.document

Return value: This property returns a reference to the document contained in the window.

Example 1:

HTML




<!DOCTYPE html>
<html>
  
<body>
    <svg viewBox="0 0 1000 1000" 
        xmlns="http://www.w3.org/2000/svg">
          
        <circle cx="200" cy="200" r="50"></circle>
          
        <script type="text/javascript">
            console.log(window.document);
        </script>
    </svg>
</body>
  
</html>

Output:



Example 2:

HTML




<!DOCTYPE html>
<html>
  
<body>
    <svg viewBox="0 0 1000 1000" 
        xmlns="http://www.w3.org/2000/svg">
          
        <text x="200" y="200">
            GeeksforGeeks
        </text>
          
        <script type="text/javascript">
            console.log(window.document);
        </script>
    </svg>
</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 :