[thelist] Is there an easy way to create new Radio Buttons?

.jeff jeff at members.evolt.org
Tue Feb 19 19:09:01 CST 2002


manish,

><><><><><><><><><><><><><><><><><><><><><><><><><><><><><
> From: Manish Sharma
>
> A solution that would work (simple for checkboxes but
> would involve a little more coding for radio buttons)
>
> 1). Create two images. One of the radio button "on"
>     state and one for "off"
> 2). Preload the images
> 3). Attach the onclick() JavaScript event to each
>     "off" state radio button image so that its source
>     (SRC) changes to "on" state At the same time, give
>     a value to a hidden element which signifies that a
>     radio button/checkbox has been clicked
> 4). Send the values via the normal way
>
> I hope all this makes sense, but I know it will work.
> How? I implemented similar "jazzy" stuff on one of my
> client's site.
><><><><><><><><><><><><><><><><><><><><><><><><><><><><><

how do you account for non-js users?  do you just cut your losses with them
with the notion that the whiz-bang eye candy is more important than
including them?

there's a better solution, but it involves replacing elements in the dom.
the form starts out with normal form elements to begin with and then upon
page load the html for them is replaced with html for the image with
attached event handlers and the associated hidden input.

if you're in the habit of developing things without considering the
consequences, then i've got an article you need to read:

Links & JavaScript Living Together in Harmony
http://evolt.org/article/thelist/17/20938/

enjoy,

.jeff

http://evolt.org/
jeff at members.evolt.org
http://members.evolt.org/jeff/




More information about the thelist mailing list