Posted By

powerthru on 10/12/10


Tagged

form checkbox


Versions (?)

Who likes this?

1 person have marked this snippet as a favorite

bigfish


Check form checkbox when the label is clicked


 / Published in: JavaScript
 

this is a way to deal with the fact that we can\'t reliably make checkboxes look larger on forms. So instead, we surround the form with a colored div, and set it up so that when the user clicks on the label next to the checkbox it checks the box.

  1. <script>
  2. function radioME(){
  3. uncheckALL("j",3)
  4. arguments[0].checked=true
  5. return true
  6. }
  7.  
  8. function uncheckALL(){
  9. var currentId=0;
  10. for(currentId=0;currentId<arguments[1];currentId++){
  11. document.getElementById(arguments[0]+currentId).checked=false
  12. }
  13. }
  14. </script>
  15.  
  16. <div style="background-color: rgb(255, 255, 204); padding: 5px; font-size: 12px; border: thin solid rgb(102, 136, 0);">
  17. <label>
  18. <input type="checkbox" onclick="radioME(this)" id="j0" value="1" name="groups_KEY658_checkbox"/>
  19. <strong>Vote for Dan Seals</strong>
  20. </label>
  21. </div>

Report this snippet  

You need to login to post a comment.