Kids

Can

JavaScript

Document Object

Each HTML page has a document object. It can help you find all other elements on the page, it can create new tag-elements, it can write a complete new content.
Here are the methods and properties unique to document, that you will need most.
Document is a Node and inherits all Node's methods and attributes. They are not all meaningful.

  • Document Methodsdescription:
  • getElementById()element is double clicked
  • getElementsByTagName()returns array containing all elements with the specified tagName
  • getElementsByClassName()returns array containing all elements with the specified className
  • getElementsByName()returns array containing all elements with the specified className
  • createElement()creates an element with the specified tag-type
  • createAttribute()creates an element with the specified tag-type
  • createDocumentFragment()creates a document fragment
  • createTextNode()creates a textNode
  • write()writes new content to the page. Wipes old content
  • Document Propertiesfires when:
  • readyStatereturns loading status of document:uninitialized/loading/interactive/complete
  • titlereturns loading status of document:uninitialized/loading/interactive/complete
  • anchorsreturns collection of all anchors on the page
  • imagesreturns collection of all images on the page
  • URLreturns full address to this page
  • domainreturns domain name of this page


<-----Back        Next --->

This username already exists.

This username already exists.

Login or register to save your work.

User name field is empty.

Your username needs to be at least 7 characters long.

Your username can not contain any of the following characters: ",', <, > , < and whitespaces.

Please enter a correct email addresss .

This email address is not found in our database .

Your password needs to be at least 7 characters long.

login
username
password
forgot password
email
register
username
password
email