The HTML DOM is a W3C standard and it is an abbreviation for the Document Object Model for HTML.
The HTML DOM defines a standard set of objects for HTML, and a standard way to access and manipulate HTML documents.
All HTML elements, along with their containing text and attributes, can be accessed through the DOM. The contents can be modified or deleted, and new elements can be created.
The HTML DOM is platform and language independent. It can be used by any programming language like Java, JavaScript, and VBScript.
Follow the links below to learn more about how to access and manipulate each DOM object with JavaScript:
Object Description
Document Represents the entire HTML document and can be used to access all elements in a page
Anchor Represents an <a> element
Area Represents an <area> element inside an image-map Base Represents a <base> element
Body Represents the <body> element Button Represents a <button> element Event Represents the state of an event Form Represents a <form> element Frame Represents a <frame> element Frameset Represents a <frameset> element Iframe Represents an <iframe> element Image Represents an <img> element
Input button Represents a button in an HTML form Input checkbox Represents a checkbox in an HTML form Input file Represents a fileupload in an HTML form Input hidden Represents a hidden field in an HTML form Input password Represents a password field in an HTML form Input radio Represents a radio button in an HTML form Input reset Represents a reset button in an HTML form Input submit Represents a submit button in an HTML form Input text Represents a text-input field in an HTML form Link Represents a <link> element
Meta Represents a <meta> element Option Represents an <option> element
Select Represents a selection list in an HTML form Style Represents an individual style statement Table Represents a <table> element
TableData Represents a <td> element TableRow Represents a <tr> element Textarea Represents a <textarea> element
JavaScript HTML DOM Objects
In addition to the built-in JavaScript objects, you can also access and manipulate all of the HTML DOM objects with JavaScript.
More JavaScript Objects
Follow the links to learn more about the objects and their collections, properties, methods and events.
Object Description
Window The top level object in the JavaScript hierarchy. The Window object represents a browser window. A Window object is created automatically with every instance of a <body> or <frameset> tag
Navigator Contains information about the client's browser Screen Contains information about the client's display screen History Contains the visited URLs in the browser window Location Contains information about the current URL
The HTML DOM
The HTML DOM is a W3C standard and it is an abbreviation for the Document Object Model for HTML.
The HTML DOM defines a standard set of objects for HTML, and a standard way to access and manipulate HTML documents.
All HTML elements, along with their containing text and attributes, can be accessed through the DOM. The contents can be modified or deleted, and new elements can be created.
The HTML DOM is platform and language independent. It can be used by any programming language like Java, JavaScript, and VBScript.
Follow the links below to learn more about how to access and manipulate each DOM object with JavaScript:
Object Description
Document Represents the entire HTML document and can be used to access all elements in a page
Anchor Represents an <a> element
Area Represents an <area> element inside an image-map Base Represents a <base> element
Body Represents the <body> element Button Represents a <button> element Event Represents the state of an event Form Represents a <form> element Frame Represents a <frame> element Frameset Represents a <frameset> element Iframe Represents an <iframe> element Image Represents an <img> element
Input button Represents a button in an HTML form Input checkbox Represents a checkbox in an HTML form Input file Represents a fileupload in an HTML form Input hidden Represents a hidden field in an HTML form Input password Represents a password field in an HTML form Input radio Represents a radio button in an HTML form Input reset Represents a reset button in an HTML form Input submit Represents a submit button in an HTML form Input text Represents a text-input field in an HTML form Link Represents a <link> element
Meta Represents a <meta> element Option Represents an <option> element
Select Represents a selection list in an HTML form Style Represents an individual style statement Table Represents a <table> element
TableData Represents a <td> element TableRow Represents a <tr> element Textarea Represents a <textarea> element
<html> <body> <script type="text/javascript"> var browser=navigator.appName; var b_version=navigator.appVersion; var version=parseFloat(b_version);
document.write("Browser name: "+ browser); document.write("<br />");
document.write("Browser version: "+ version); </script> </body> </html> <html> <body> <script type="text/javascript"> document.write("<p>Browser: "); document.write(navigator.appName + "</p>"); document.write("<p>Browserversion: "); document.write(navigator.appVersion + "</p>");
document.write("<p>Code: "); document.write(navigator.appCodeName + "</p>"); document.write("<p>Platform: "); document.write(navigator.platform + "</p>"); document.write("<p>Cookies enabled: "); document.write(navigator.cookieEnabled + "</p>");
document.write("<p>Browser's user agent header: "); document.write(navigator.userAgent + "</p>"); </script> </body> </html> <html> <body> <script type="text/javascript"> var x = navigator; document.write("CodeName=" + x.appCodeName); document.write("<br />"); document.write("MinorVersion=" + x.appMinorVersion); document.write("<br />"); document.write("Name=" + x.appName); document.write("<br />");
document.write("Version=" + x.appVersion); document.write("<br />"); document.write("CookieEnabled=" + x.cookieEnabled); document.write("<br />"); document.write("CPUClass=" + x.cpuClass); document.write("<br />"); document.write("OnLine=" + x.onLine); document.write("<br />"); document.write("Platform=" + x.platform); document.write("<br />"); document.write("UA=" + x.userAgent); document.write("<br />"); document.write("BrowserLanguage=" + x.browserLanguage); document.write("<br />"); document.write("SystemLanguage=" + x.systemLanguage); document.write("<br />"); document.write("UserLanguage=" + x.userLanguage); </script> </body> </html> <html> <head> <script type="text/javascript"> function detectBrowser()
{
var browser=navigator.appName; var b_version=navigator.appVersion; var version=parseFloat(b_version);
if ((browser=="Netscape"||browser=="Microsoft Internet Explorer") && (version>=4))
{
alert("Your browser is good enough!"); }
else {
alert("It's time to upgrade your browser!"); } } </script> </head> <body onload="detectBrowser()"> </body> </html>
JavaScript Cookies
A cookie is often used to identify a user.