JavaScript HTML DOM Examples

❮ Previous Next ❯

Examples of using JavaScript to access and manipulate DOM objects.


The Document Object

Display all name/value pairs of cookies in a document Display the domain name of the server that loaded the document Display the date and time the document was last modified Display the title of a document Display the full URL of a document Replace the content of a document Open a new window, and add some content Display the number of elements with a specific name Display the number of elements with a specific tag name

Document Object Explained


The Anchors Collection

Find the number of anchors in a document Find the innerHTML of the first anchor in a document

The Links Collection

Display the number of links in a document Display the href attribute of the first link in a document

The Forms Collection

Find the number of forms in a document Find the name of the first form in a document

The Images Collection

Return the number of images in a document Return the id of the first image in a document

CSS Manipulation

Change the visibility of an HTML element Change the background color of an HTML element

❮ Previous Next ❯
Copyright 1999-2023 by Refsnes Data. All Rights Reserved.