document.defaultView

In this chapter you will learn:

  1. How to get Window object from document object in Javascript

document.defaultView

document.defaultView returns the Window object.

<!DOCTYPE HTML> <!--from  jav  a2 s  .c  om-->
<html> 
    <body> 
        <script type="text/javascript"> 
            document.writeln(window.outerWidth); 
            document.writeln(document.defaultView.outerHeight); 
        </script> 
    </body> 
</html>

Click to view the demo

Next chapter...

What you will learn in the next chapter:

  1. How to get HTML elements by its tag name in Javascript
Home » Javascript Tutorial » Document
Document Object
document.body
document.characterSet
document.charset
document.compatMode
document.cookie
document.defaultCharset
document.defaultView
getElementsByTagName(tagName)
document.getElementsByClassName
document.getElementsByName
document.images
document.lastModified
document.location
document.implementation
document.querySelectorAll
document.readyState
document.title
document.URL
document.writeln