JavaScript makes web pages interactive and HTML "dynamic".
JavaScript relies on a document object model to reference the elements, attributes, and properties of a web page.
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title>A Very Simple Document</title>
<style>....</style>
<script>....</script>
</head>
<body>
<h1>Simple Documents</h1>
<p>
The sad truth is that simple docs
<em>are not so simple</em>
after all.
</p>
<p>Blah, blah, blah, blah.</p>
</body>
</html>
window.document.body
window.
portion of it,
and begin all non-window references with just document.
, e.g.
document.write("some text")
name
attribute, and it is the first such element with a particular value, then it can always be referenced by that name, e.g.
<img name="amherst" src="ljamherst.jpg">
<script language="JavaScript">
document.amherst.src = "lpelham.jpg"
</script>
name
attribute with the same value,
then you can get an array of references to them with a function call:
<img name="amherst" src="ljamherst.jpg">
<form name="amherst"></form>
<script language="JavaScript">
document.getElementsByName("amherst")
</script>
id
attribute, it should have a unique value in the document, and a reference to it can be obtained with a different function call:<p id="jeffery">The Lord Jeffery Amherst, mascot of Amherst College.</p>
<script language="JavaScript">
document.getElementByID("jeffery") = "lpelham.jpg"
</script>
Event Handlers
onBlur/onFocus
onClick/onMouseDown/onMouseUp
onKeyDown/onKeyUp
onLoad
onMouseOver/onMouseOut
onSubmit/onReset