Writing information to forms. : Elements « Form « JavaScript Tutorial






<HTML>
    <HEAD>
    <TITLE>Example of Writing Form Elements</TITLE>
    <SCRIPT LANGUAGE="JavaScript">
    <!--
    function checkText(){
      if( document.FormExample3.textbox.value == "AAA"){
        alert("You are correct!");
      } else {
        document.FormExample3.textbox.value = "AAA";
        alert("That is incorrect. The correct answer is now in the text box.");
      }
    }
    // End hide-->
    </SCRIPT>
    </HEAD>
    <BODY>
    <FORM NAME="FormExample3" METHOD=POST>
    Input <INPUT TYPE="text" NAME="textbox" SIZE=25>
          <INPUT TYPE="BUTTON" NAME="Bugs" VALUE="Submit" onClick="checkText(this.form)">
    </FORM>
    </BODY>
    </HTML>








10.4.Elements
10.4.1.Accessing and Writing Information
10.4.2.Writing information to forms.
10.4.3.Reference form element by using the dot notation
10.4.4.Loop through all elements in a form
10.4.5.Check Form element type