The Math Forum: 1998 Summer Institute - sum98

Javascript Examples & Explanation

1998 Summer Institute || Participant Projects || List of Participants || Sum98 Staff || Agenda

Below are some examples of form elements that are commonly used. Below each form element is the HTML that creates it. Javascript can be used to validate data before it is submitted in an HTML form. The form elements below are right now affected by some javascripts. The red highlighted text shows how the javascript function are called.

Look at these javascript examples in a new window. Compare the functions as they are defined with how they are called in an HTML document.You can copy and paste these examples to use in your own HTML pages.

Take a look at the Javascript References and Code Examples.

Have fun! Click around on this page to see the Javascript at work.

<FORM NAME="forum"  onSubmit="return (emailCheck() && makeChoice())">

<INPUT TYPE="text" VALUE="" NAME="text1" SIZE="30" MAXLENGTH="30">

<INPUT TYPE="checkbox" VALUE="Milk" NAME="drink" CHECKED onClick="checkChecker()"> Milk<BR>
<INPUT TYPE="checkbox" VALUE="Bread" NAME="eat" onClick="checkChecker()"> Bread<BR>
<INPUT TYPE="checkbox" VALUE="Water" NAME="live" onClick="checkChecker()"> Water<BR>

<SELECT NAME="list1" onBlur="makeChoice()">
	<OPTION VALUE="opt0">Choose One
	<OPTION VALUE="opt1">option1
	<OPTION VALUE="opt2">option2
	<OPTION VALUE="opt3">option3

<INPUT TYPE="button" VALUE="Press Me" NAME="nullbutton" onClick="noEntry()"><BR>

<TEXTAREA NAME="largetext" ROWS="3" COLS="40"></TEXTAREA>

<input TYPE="submit" VALUE="Submit Information Now!">


[Privacy Policy] [Terms of Use]

Home || The Math Library || Quick Reference || Search || Help 

© 1994- The Math Forum at NCTM. All rights reserved.

Math Forum

7 July 1998