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 Link to comment https://forums.phpfreaks.com/topic/86039-disabling-checkboxes/ 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> Link to comment https://forums.phpfreaks.com/topic/86039-disabling-checkboxes/#findComment-439443 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.