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.
Element | Description |
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.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.navId-405067.html
No comments:
Post a Comment