DOM

Methods

getElementById

We get the element by its id. We call it. We can then manipulate it.

For instance, if the element happens to be an anchor tag, we could extend the object to its href:

document.getElementById("myLink").href = "url";

We would manipulate it by changing the url.

Next >


< Previous

[Page Top]

Introduction to DOM, by Dr Sam
copyright | contact
published by OxfordU.net

[An alternative, straight-text version is also available.]