Q:

how to define a text field value in code

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

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).  
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 ??? 
</script>

<script type="text/javascript">

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" && b == "green" && 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";
   } 
}

</script>
</script>

A:

you haven't called your script on button click, check working example here http://jsfiddle.net/3CgcH/7/
you need to specify onclick handler for button which will call checkValues function
<input name="confirm" type="button" class="form_colour" id="confirm" value="Confirm" onclick="checkValues();" />

more proper way would be to use addEventListener and attachEvent to register events on html elements

