Online: 9852
Latest Posts
Top Posts
ASP.NET MVC
AngularJS
SQL Server
jQuery
CSharp
HTML5
Excel
More
Live Examples
Tools
Password Generator Online
HTML Encoder and Decoder
URL Encoder and Decoder
Xml to Json
Code Editor
Color Picker and Preview
Android OS
C#
Misc.
Typescript
JavaScript
CSS3
Bootstrap
Sharepoint
JavaScript > HTML DOM
Search posts under JavaScript:
DOM Document in JavaScript
What is DOM Document and what is the use od DOM Document in javascript?
Previous Post
HTML DOM Document
HTML DOM Document is defined as an object in the webpage.
HTML DOM Document is used to represent webpage.
HTML DOM Document is used to access any HTML element.
Some of HTML DOM Document which are used to access HTML.
Finding HTML Elements
document.getElementById(id) - Finds an element using element id
document.getElementByTagName(name) - Finds element by tag name
document.getElementByClassName(name) - Finds element by class name.
Changing HTML ELements
element.innerHTML= new html content - changes the innerHTML of element
element.attribute= new value - changes the attribute value of HTMLelement
element.setAttribute(attribute, value)-changes the attribute value of HTMLelement
element.style.property=new style-changes the style of an HTML element
Adding and Deleting elements
document.createElement(element)- creates an HTML element
document.removeChild(element)-removes an HTML element
document.replaceChild(element)-replaces an HTML element
document.appendchild(element)- adds an HTML element.
document.write(text)- Write in to HTML output stream.
Adding Event handlers
document.getElementById(id).onclick=function(){code} - Adds event handler code to onclick event.
Finding HTML Objects
document.anchors- returns all <a> elements which have name attribute
document.URL - returns url of the document.
document.body - returns body of the element
document.baseURI - returns absolute base URI of the document.
document.cookie - returns the document cookies
document.doctype - returns document doctype.
document.documentElement- returns HTML element.
document.documentMode - returns the mode used by the user.
document.documentURI - returns the document of the URI.
document.domain - returns the domain name of the server.
document.embeds - It returns all <embed> elements.
document.forms - returns all <form> elements.
document.head - returns all <head> element.
document.images - returns all <img> elements.
document.implementation - returns all DOM implementations.
document.inputEncoding - returns all documents encoding.
document.lastModified - returns date and time of the document.
document.links - defines all <href> attributes.
document.readyState -
returns current status of the document.
document.URI refferer - returns URI of the refferer.
document.scripts - returns all <script> elements.
document.title - returns all<title> element
document.StrictErrorChecking - returns if error checking is enforced.
Demo URL
Views: 3672 | Post Order: 205
Previous Post
Ask
JavaScript question
Report Error
Related Posts
DOM Methods
Object Prototypes
Inheritance
Write for us
Utility Tools
Password Generator
Live Code Editor
Xml to Json
HTML Encoder Decoder
URL Encoder Decoder
Hosting Recommendations