unemployment Posted January 30, 2011 Share Posted January 30, 2011 This fails on me. Firebug says msg is undefined. function selectone () { var msg = document.getElementsByName('pm'); var i = 0; for(i; i < msg.elements.length; i++) { if(msg.elements[i].checked === checked) { document.getElementById('multiple_action').disabled = false; document.getElementById('drop_button').setAttribute("class", "drop_button"); } else { document.getElementById('multiple_action').disabled = true; document.getElementById('drop_button').setAttribute("class", "drop_button disabled"); } } } Quote Link to comment Share on other sites More sharing options...
brianlange Posted January 30, 2011 Share Posted January 30, 2011 Can you post html or provide a url? Quote Link to comment Share on other sites More sharing options...
unemployment Posted January 30, 2011 Author Share Posted January 30, 2011 Can you post html or provide a url? HTMl below <form method="get" id="pm" name="pm" onsubmit="return false;"> <table class="messages"> <tr> <td class="box_column"> <label><input type="checkbox" name="pmcheckbox" onclick="selectone();" value="pm<?php echo $message['message_id']; ?>" /></label> </td> </tr> </form> Quote Link to comment Share on other sites More sharing options...
sunfighter Posted January 30, 2011 Share Posted January 30, 2011 This looks like you have more than one checkbox. I think you should send the id of the ckbox to the function. And msg is empty. Would document.getElementsByTagName("INPUT"); work better for you? P.S. you don't have an id for any of the checkboxes. Quote Link to comment Share on other sites More sharing options...
unemployment Posted January 30, 2011 Author Share Posted January 30, 2011 This looks like you have more than one checkbox. I think you should send the id of the ckbox to the function. And msg is empty. Would document.getElementsByTagName("INPUT"); work better for you? P.S. you don't have an id for any of the checkboxes. Is this what you meant? I added an id to the checkbox of msgcheckbox. function selectone () { var msg = document.getElementsById('pm'); var i = 0; for(i; i < msg.elements.length; i++) { if(msg.elements[i].checked == true) { document.getElementById('multiple_action').disabled = false; document.getElementById('drop_button').setAttribute("class", "drop_button"); } else { document.getElementById('multiple_action').disabled = true; document.getElementById('drop_button').setAttribute("class", "drop_button disabled"); } } } 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.