< html >
< head >
< title >Sample HTML Document< /title >
< /head >
< body text="#000000" bgcolor="#FFFFFF" link="#0000EE" vlink="#551A88" alink="#FF0000" >
< p >
< script language="JavaScript" >
function handleClick( theButton, theForm )
{
if ( theButton.name == "Button_Me" )
{
theForm.total.value = "You Pressed Me";
}
else
if ( theButton.name == "Button_Him" )
{
theForm.total.value = "I said to press the other button";
}
else
if ( theButton.name == "Clear" )
{
theForm.total.value = "";
}
}
< /script >
This is a Sample HTML document < /p >
< p >
< form name="MyForm">< font size=+2 >Stuff< /font >
< input name="Total" size=50>< /input >
< p >
< input type ="button" name="Button_Me" value="Press Me" onClick="handleClick(this, this.form)" >< /input >
< p >
< input type ="button" name="Button_Him" value="Press the other button" onClick="handleClick(this, this.form)" >< /input >
< p >
< input type ="button" name="Clear" value="Clear Stuff" onClick="handleClick(this, this.form)" >< /input >
< p >
< /form >
< p >
< script language="JavaScript" >
document.writeln( "Loaded Document: " + location.href + "< br >");
document.writeln( "Document Title: " + document.title + "< br >");
document.writeln( "< p >" );
document.writeln( "This document contains " + document.MyForm.elements.length + " form elements. < p >");
for (var i = 0 ; i < document.MyForm.elements.length ; i++)
{
document.writeln( "Element #" + (i+1) + " is named " + document.MyForm.elements[i].name );
document.writeln( " and has a value of " + document.MyForm.elements[i].value + "< br >");
}
< /script >
< /body >
< /html >