I have 3 checkboxes I need a javascript that will pop up a message or something if the end user tries to select boxes 1 and 3 2 and 3 is ok, 1 and 2 is ok, or just 1 2 or 3 is ok, but 1 and 3 is NOT ok.. ANY help would be greatly appriciated! Thanks..
Using the following sample names for the form and checkboxes: <form name="myform" id="myform" action="" method="post"> <input type="checkbox" name="chk[]" /> <input type="checkbox" name="chk[]" /> <input type="checkbox" name="chk[]" /> </form> Code (markup): <script type="text/javascript"> function mycheck () { var mycheckbox = document.myform.elements["chk[]"]; if (mycheckbox[0].checked && mycheckbox[2].checked) { alert("Not OK"); return false; } else { return true; } } </script> Code (markup):