how to define a text field value in code
<pre><code>&lt;form id="form2" name="form2" action=""&gt;
   &lt;div class="form_colour" id="formcolour"&gt;&lt;img src="../Images/red_car.jpg" alt=""   width="370" height="124" /&gt;This car is
      &lt;label for="textarea"&gt;&lt;/label&gt;
      &lt;input name="text_1" type="text" class="form_colour" id="text_1" /&gt;
   &lt;/div&gt;
   &lt;p&gt;&amp;nbsp;&lt;/p&gt;
   &lt;p&gt;&lt;img src="../Images/green_car.jpg" width="370" height="124" /&gt;This car is
      &lt;input name="text_2" type="text" class="form_colour" id="text_2" /&gt;
   &lt;/p&gt;
   &lt;p&gt;
      &lt;img src="../Images/Yellow_car.jpg" width="370" height="124" /&gt;This car is
      &lt;input name="text_3" type="text" class="form_colour" id="text_3" maxlength="8" /&gt;
   &lt;/p&gt;
   &lt;p&gt;
      &lt;input name="confirm" type="button" class="form_colour" id="confirm" value="Confirm" /&gt;
   &lt;/p&gt;
&lt;/form&gt;
</code></pre>

<p>I currently have the following code for a form which has 3 text fields in them(Code for the form is above this and the Javascript code is below this text). </p>

<p>My aim is based on the input of the text values the user will either get a message and stay on the page or if they are correct get a message and go to another page. I did this previously for drop down lists. and all i did was just change the variables from the drop down list names to the text field names. Now when i run this, nothing happens, do i need to do something more ???</p>

<pre><code>&lt;/script&gt;

&lt;script type="text/javascript"&gt;

function checkValues() {  // this line must be within the script tags
   var a = document.form2.text_1.value;    
   var b = document.form2.text_2.value; 
   var c = document.form2.text_3.value; 

   if (a == "red" &amp;&amp; b == "green" &amp;&amp; c == "yellow"){ 
      alert ("Correct you have won press OK for your Reward!") 
      window.location.href = "Reward.html";   // redirect to new page
   } 
   else { 
      alert ("Not right Please try again!"); 
      window.location.href = "Money_Match.html";
   } 
}

&lt;/script&gt;
&lt;/script&gt;
</code></pre>
