[thelist] images as radio buttons

Benjer futureweb at macmail.com
Wed Oct 16 10:53:00 CDT 2002


forgot the browser tests so here they are just in case:

function init(){
    //set variables for browser usage here and use as global
    //basic ns4 test
    isNS4=(document.layers ? true : false);
    // overly simplistic test for IE
    isIE4 = (document.all && !document.getElementById) ? true : false;
    // both IE5 and NS6 are DOM-compliant which is WC3 standard
    // along with Opera Mozilla and futrure browsers
    isDOM = (document.getElementById) ? true : false;
}

<body onLoad="init()">

On 16/10/02 5:28 pm, "Michael Robertson" <mike at mikeemedia.com> wrote:

> --
> [ Picked text/plain from multipart/alternative ]
> I'm trying write a javascript function that will allow me to select an image
> from a  group of images like radio buttons and change when selected as well as
> have the corresponding radio button checked when the image is clicked. This is
> kind of working however sometimes the images just disappears when clicked as
> opposed to changing and I would also like the image to return to it's original
> state when another image is checked. Any suggestions to accomplish this.
>
> function pickChar(who,what,on){
> if(!document.getElementById(who).checked){
>  document.getElementById(who).checked=true;
>  document.getElementById(what).src= on;
>  }
> }
>
> <div id="charLayer1">
>       <div class="txtcenter">
>           <a href="javascript:;"
> onClick="pickChar('char1','dude1','../images/char1Aon.gif')">
>               <img src="../images/char1A.gif" width="73" height="103"
> name="dude1" id="dude1" border="0" />
>               </a><br />
>               <input name="Character" type="radio" value="char1" id="char1" <%
> If charMod="char1" Then%> checked <% End If %> />
>       </div>
>   </div>
> --
>





More information about the thelist mailing list