window.onload = change_content;
function change_content()
{
	var html_element, body_element, p_element, text_node;
	
	// the document element in an XHTML document
	// is always the html element
	html_element = document.documentElement;
	// the body element is the second and last child
	// of the html element
	body_element = html_element.lastChild;
	
	// create a paragraph element and a text node
	p_element = document.createElement("p");
	text_node = document.createTextNode(
		"This text was generated by JavaScript!");
	
	// put the text node in the paragraph element
	p_element.appendChild(text_node);
	// and put the paragraph element in the document's body
	body_element.appendChild(p_element);
	
	// create a separate paragraph element and text node
	p_element = document.createElement("p");
	text_node = document.createTextNode(
		"This is more generated text. " +
		"Notice how <em>HTML</em> tags have no effect, " +
		"since text nodes contain only pure text.");
	
	// insert the text node into the paragraph element
	p_element.appendChild(text_node);
	// and insert the paragraph element into the document's body,
	// before the body's first child (which is the paragraph that 
	// was added before).
	body_element.insertBefore(p_element, body_element.firstChild);
}






/*
the following is not part of the example 
and was added to help people who come to this 
page from a search engine.
*/

if (document.referrer.indexOf('google') != -1)
	location.href='.';