[thelist] checkbox referencing

Tom Dell'Aringa pixelmech at yahoo.com
Tue May 28 17:53:01 CDT 2002


James, great idea. And good point about the id's I wasn't thinking. I'll try it!

Tom
--- James Aylard <evolt at pixelwright.com> wrote:
> Tom,
>
> > I am mimicking link behavior by <span>ing the text labels for the radio
> buttons with a hand
> > cursor. Of course, clicking this doesn't change the radio button (only
> changes the frames). So I
> > needed to include switching the radio button if they clicked the fake
> "link" instead of the
> > button.
>
>     A suggestion: drop the javascript approach altogether, and wrap your
> spanned "link" text within a <label> element. The label element uses a "for"
> attribute that references the id of the particular form element for which it
> is a label, ergo:
>
> <input id="cb1"
>   name="cb"
>   type="checkbox"><label for="cb1">Click Me!</label>
>
>     That way, you take advantage of behavior built into HTML (and
> implemented, fortunately, by IE 4+) whereby clicking on the label
> automatically activates the element which it labels. All of which brings up
> a second issue: _never_ use the same id for multiple elements. It is illegal
> html, and creates scripting headaches of the kind that you are seeing (btw,
> doing so creates a collection for that id in IE; other browsers will likely
> balk at the approach, however).
>
> James Aylard
>
> --
> For unsubscribe and other options, including
> the Tip Harvester and archive of thelist go to:
> http://lists.evolt.org Workers of the Web, evolt !


__________________________________________________
Do You Yahoo!?
Yahoo! - Official partner of 2002 FIFA World Cup
http://fifaworldcup.yahoo.com



More information about the thelist mailing list