Wrox Home  
Search P2P Archive for: Go

  Return to Index  

javascript thread: JScript to control select boxes: how?


Message #1 by James Birchler <jamesbirchler@y...> on Tue, 29 May 2001 16:49:04 -0700 (PDT)
Subject: JScript to control select boxes: how?
From: James Birchler <jamesbirchler@y...>

well you have to give the boxes names first like this

<form>
<input type="checkbox" name="check1" onClick="doCheck(this.form)">
<input type="checkbox" name="check2" onClick="doCheck(this.form)">
<input type="checkbox" name="check3" onClick="doCheck(this.form)">
</form>

and your script should be

function doCheck(yourForm) {
    if ( yourForm.check3.checked ) {     //your box is checked
        yourForm.check1.checked=false;
        yourForm.check2.checked=false;
    }
}

and remember to put
<meta http-equiv="Content-Script-Type" content="text/jscript">
when you use scripts to handle events


  Return to Index