The Document Object Model methods shown in the following list offer you a great way to access and modify your Web pages through your JavaScript code.

  • myElement = document.getElementById("name");: Gets an element from the page with the specified ID and copies a reference to that element to the variable myElement.

  • myElement.innerHTML = "value": Changes the value of the element to "value".

  • document.onkeydown = keyListener: When a key is pressed, a function called keyListener is automatically activated.

  • document.onmousemove = mouseListener: When the mouse is moved, a function called mouseListener is automatically activated.

  • setInterval(function, ms);: Runs function each ms milliseconds.

  • myArray = document.getElementByName("name"): Returns an array of objects with the current name (frequently used with radio buttons).