document.getElementById(id)
document.getElementsByTagName(name)
document.createElement(name)
parentNode.appendChild(node)
element.innerHTML
element.style.left
element.setAttribute
element.getAttribute
element.addEventListener
window.content
window.onload
window.dump
window.scrollTo
use to manipulate the DOM hierarchy
function foo(event) {
// the evt parameter is automatically assigned the event object
alert(event);
}
table_el.onclick = foo;
example: https://developer.mozilla.org/en-US/docs/Web/API/Event/eventPhase
The EventTarget.addEventListener() method registers the specified listener on the EventTarget it's called on.
<table id="outside">
<tr><td id="t1">one</td></tr>
<tr><td id="t2">two</td></tr>
</table>
// Function to change the content of t2
function modifyText() {
var t2 = document.getElementById("t2");
if (t2.firstChild.nodeValue == "three") {
t2.firstChild.nodeValue = "two";
} else {
t2.firstChild.nodeValue = "three";
}
}
// add event listener to table
var el = document.getElementById("outside");
el.addEventListener("click", modifyText, false);