<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/XHTML1/DTD/XHTML1-strict.dtd">
<html xmlns="http://www.w3.org/1999/XHTML" xml:lang="en" lang="en">
<head>
<title>Page Title</title>
<meta http-equiv="content-type" content="text/html; charset=utf-8" />
<meta http-equiv="Content-Language" content="en-us" />
</head>
<body>
<h1>This is a heading</h1>
<p>This is a paragraph with a <a href="http://easy-reader.net">link</a></p>
<ul>
<li>a list item</li>
<li>another list item</li>
<li>a third list item</li>
</ul>
</body>
</html>
getter { setter }
p { color: red; }
#footer { font-size: small; }
var myNode = document.getter()
myNode.setter()
document.getElementById(ID)
document.getElementsByTagName(tagName)
element.getAttribute(attributeName)
var myElement = document.getElementById(ID)
var myArray = document.getElementsByTagName(tagName)
var myString = myElement.getAttribute(attributeName)
Get the element with the ID "content".
#content { }
document.getElementById("content")
Get all the paragraphs in a document.
p { }
document.getElementsByTagName("p")
#content p { }
document.getElementById("content").getElementsByTagName("p")
document.write()
innerHTML
document.createElement(tagName)
document.createTextNode(text)
element.setAttribute(name,value)
var myElementNode = document.createElement(tagName)
var myTextNode = document.createTextNode(text)
myElementNode.setAttribute(name,value)
element.appendChild(newNode)
element.insertBefore(newNode,targetNode)
Make use of the cite
attribute in blockquotes.
var quotes = document.getElementsByTagName("blockquote");
for (var i=0; i<quotes.length; i++) {
var source = quotes[i].getAttribute("cite");
if (source) {
var link = document.createElement("a");
link.setAttribute("href",source);
var text = document.createTextNode("source");
link.appendChild(text);
quotes[i].appendChild(link);
}
}
var quotes = document.getElementsByTagName("blockquote");
for (var i=0; i<quotes.length; i++) {
var source = quotes[i].getAttribute("cite");
if (source) {
var link = document.createElement("a");
link.setAttribute("href",source);
var text = document.createTextNode("source");
link.appendChild(text);
var para = document.createElement("p");
para.className = "attribution";
para.appendChild(link);
quotes[i].appendChild(para);
}
}
Make use of the cite
attribute in blockquotes.
Do unto others:
<select>
Replacement: An Example<select>
Replacement: How It’s Done<select>
s and with each…<ul>
that is modelled on it<select>
:focus
to trap keyboard events (for additional accessibility)<select>
and show the <ul>
$()
instead of document.getElementById( 'theID' )