Change Your Web Page with JavaScript Document Object Model Methods

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

































ElementDescription
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 = keyListenerWhen a key is pressed, a function called keyListener is automatically activated.
document.onmousemove = mouseListenerWhen the mouse is moved, a function called mouseListener is automatically activated.
setInterval(function, ms);Runs function each ms milliseconds.
myArray = document.getElementsByName("name")Returns an array of objects with the current name (frequently used with radio buttons).







dummies

Source:http://www.dummies.com/how-to/content/change-your-web-page-with-javascript-document-obje.html

No comments:

Post a Comment