Several of these examples rely on JavaScript code that can be found in the file scripts.js.
| TO GET THIS | USE THIS |
|---|---|
<FORM> <INPUT TYPE="button" VALUE="Red" onClick=document.bgColor="#FF0000"> <INPUT TYPE="button" VALUE="White" onClick=document.bgColor="#FFFFFF"> </FORM> | |
<FORM>
<INPUT TYPE="button" VALUE="Click Me" onClick="alert('You did it!')">
</FORM>
| |
<SCRIPT> var d = new Date(); document.write((d.getMonth()+1) + "/" + d.getDate() + "/" + d.getFullYear()); </SCRIPT> | |
<SCRIPT> var d = new Date(); var months = ["Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"]; document.write(months[d.getMonth()] + " " + d.getDate() + ", " + d.getFullYear()); </SCRIPT> | |
<form name="sw">
<table width="100%">
<tr><th colspan="3">Countdown</th></tr>
<tr align="center"><td>Start at:</td>
<td><input type="text" name="beg2" size="7" value="0:10"></td>
<td><input type="button" value="Start" onclick="Down('Boom!')"></td></tr>
<tr align="center"><td colspan="3"><input type="text" name="disp2" size="9"></td></tr>
</table>
</form>
| |
<script> if (getName() != null) document.write("Welcome back, " + getName() + "<br><br>"); </script>
<form name="nameform">
Please enter your name: <input type="text" name="nameinput"><br><br>
<input type="button" value="Set Name" onClick = "setName(document.nameform.nameinput.value)">
</form>
|