DJTim666 Posted January 15, 2008 Share Posted January 15, 2008 I am trying to disable some checkboxes on my website depending on how many current checkboxes are clicked. So for example I am going to have 6 checkboxes and if 2 are clicked then I want the other 4 to be disabled. I tried using an array, I tried plusing and minusing and I tried some other ways, all failing. If someone could PLEASE help me that would be greatly appreciated. -- DJ Quote Link to comment Share on other sites More sharing options...
warran Posted January 15, 2008 Share Posted January 15, 2008 <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"> <HTML> <script> function go(){ var objs=document.getElementsByTagName("input"); var num=0; for(k=0;k<objs.length;k++){ if(objs[k].type=="checkbox" && objs[k].checked==false){ num+=1; objs[k].disabled="false"; } } } </script> <BODY> <input type="checkbox"><input type="checkbox"><input type="checkbox"><input type="checkbox"><input type="checkbox"><input type="checkbox"> <input type="button" value="go go go" onclick=go() > </BODY> </HTML> Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.