[Javascript] Auto deleselecting a check box

Mike Dougherty mdougherty at pbp.com
Thu Apr 29 16:04:38 CDT 2004


>see html content change so much that I try to save myself a lot of work by making my scripts a 
>bit light on their feet and more forgiving of page format & content changes...
   This is especially good advice if your "webmaster" is doing layout/content and then hands you a 
clunky HTML picture and asks you to make it 'work'  (then decides to again change the layout)

>Also, Peter, your code assumes that the onClick event occurs when a country box is checked, 
>whereas it will also fire if one is unchecked, so you really need to include the value of the 
>checked property in your logic.

   The onClick method does not fire if you (gasp) use the keyboard.  If the object preceeding this 
control in the tabbing order was some kind of text entry, then the onChange method might be 
advisable - if a checkbox is clicked: it implicitly changes the value.  If there is no change upon 
moving through the control with Tab, then there's nothing to do anyway.  Whichever method is used, 
I agree that the state of the control's "checked" property should be considered if only for 'best 
practice' defensive coding.



More information about the Javascript mailing list