I have a Page as http://tinyurl.com/4uk7esy Now what I am looking is When I click on Subscribe Button , it shld check whether box check Boxes are Checked or Not If Not then Don't Proceed. Subscribe Button is NOT a Normal Command Button. Code for Check Box ************************* Code of Button : *************************
Didn't test it, but you could try placing these lines right at the beginning of goPayment Function: function goPayment() { var chk_agree = document.getElementById('agree'); var chk_agree1 = document.getElementById('agree1'); if (!chk_agree.checked || !chk_agree1.checked) return false; ... Code (markup):
Again, didn't test the sample, but by looking at your code, this line is wrong: alert chk_agree.checked; Code (markup): Try leaving it out for testing purposes or rewrite it as: alert(chk_agree.checked); Code (markup): Seeing as it's only there for debugging purposes, you can leave it out, it would just output "false" anyways.
i would do this with onsubmit in a form and try the following. This way the user doesnt see the popup error but the entire form is disabled unless the checkbox is checked. document.getElementById('submit').disabled = true; if (document.forms["formname"]["agree"].checked = "1") { document.getElementById('submit').disabled = false; } else{ return false; }