Difference between Document Object and Window Object

 


 

WINDOW OBJECT:

   The top most object and the outermost element of the object hierarchy is the Window Object.



DOCUMENT OBJECT:

    Each HTML, PHP, or other documents that gets loaded into a window becomes a Document Object.


WINDOW OBJECT:

   The Window Object represents a Window or Tab which contains a DOM Document.

DOCUMENT OBJECT:

    The Document Object is the property of window object. It points to the DOM Document which is loaded in the Window Object.


WINDOW OBJECT:

     Some of the Window Object methods are alert( ), clearInterval( ), clearTimeout( ), close( ), confirm( ).

DOCUMENT OBJECT:

    The Document Object is accessed with "window.document" or just "document". Some of the Document Object methods are createEvent( ), createElement( ), createAttribute( ), addEventListener( ).


Comments