about


Scribe:

chrono

blog

Time

science!

book musings

gov

'punk

missle defense

jams

antiques

cultcha blog


Construct:

scripts & programs

on the town

snaps


Self:

creds (PDF)

key

missive


JavaScript: Inserting Text Into the Body of a Page

Javascript is program code that can be embedded into a Web page. You can also use Javascript to generate Web pages on the fly.

Javascript is event driven. It does something in response to a user-action–mouse movements, keyboard, etc.

JavaScript functions can be placed in the head of a Web page (or called from a separate .js file listed in the head) and called by an event handler placed in the body of the document.

To create a function that places text on a Web page, enter this function in the head section:

<script>
function place() {
	var msg = "";
	document.open();
	document.write(msg);
	document.close();
	}
</script>
And then augment the body tag so it calls the place function thusly:
<body onload="place()">

Example