[Javascript] Auto deleselecting a check box
Paul Novitski
paul at novitskisoftware.com
Thu Apr 29 16:43:48 CDT 2004
Mike, I think you're wrong (at least in IE & Netscape), both about the
onclick() event not responding to the keyboard (space bar), and about the
onchange() event applying to an input/checkbox tag.
<input type=checkbox onchange="alert('change');" onclick="alert('click');">
Try this
Paul
At 02:04 PM 4/29/2004, Mike Dougherty wrote:
>>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.
>_______________________________________________
>Javascript mailing list
>Javascript at LaTech.edu
>https://lists.LaTech.edu/mailman/listinfo/javascript
More information about the Javascript
mailing list