I need to see if a check box is ticked at the moment i am using the code. .. else if (document.callback.terms.value <= "") { alert ("You must accept the terms and conditions"); return false; } Code (markup): but this isnt working. Please advise. Thanks
You shouldn't have a checkbox outside of a form. <form action=""> <input type="checkbox" name="agree"> </form> if (document.forms[0]['agree'].checked) { //do something } else { // do something else } Code (markup):
See my code below. This will get you what you want: <script type="text/JavaScript"> <!-- function waterbrook() { if (document.trotwood.steerforth.value !="James" && document.trotwood.steerforth.value != "james") { alert ("Error. Try again."); return false; } if (document.trotwood.steerforth.value == "") { alert ("Error. Try again."); return false; } if (document.trotwood.wickfield.checked == false) { alert ("Check the box, please!"); return false; } return true; } // --> </script>