Here is some code I just wrote for a site for our soccer league. Function 1
checks values of a two select list the checks or unchecks a box. The
second function prevents the user from checking/unchecking the check box.
This should give you some ideas.
Good luck
David
--------> calling code
<td align="center"><input type="checkbox" name="update_#tostring(nX)#"
value="" onclick="ischecked(this)"></td>
<td><font style="font-size: medium; color: ##0000CC; font-weight:
bold;">#gday.hteam#</font></td>
<td align="center">
<select name="hscore_#tostring(nX)#" size="1"
onChange="update_check(this)">
<script language="javascript">
writeoption(#gday.hscore#)
</script>
</select>
</td>
----------> end calling code
function update_check(objIn) {
var cX = objIn.name.substring(objIn.name.indexOf("_") +
1,objIn.name.length)
var cUpdate = "window.document.form0.update_" + cX + ".checked = "
var cHscore = "window.document.form0.hscore_" + cX + ".selectedIndex"
var cVscore = "window.document.form0.vscore_" + cX + ".selectedIndex"
var x = eval(cHscore)
if ( eval(cHscore) > 0 && eval(cVscore) > 0) {
eval(cUpdate + "true")
}
else {
eval(cUpdate + "false")
}
return null}
function ischecked(objChk) {
if (objChk.checked == true ) {
objChk.checked = false }
else {
objChk.checked = true }
return null }
----- Original Message -----
From: "Boardwine, David L." <[EMAIL PROTECTED]>
To: "CF-Talk" <[EMAIL PROTECTED]>
Sent: Wednesday, September 12, 2001 11:54 AM
Subject: Using Javascript to relate checkboxes
> Hi All,
>
> I want to automatically check (and disable) one checkbox when another of
> several checkboxes is checked. Can I do this with client-side scripting?
Any
> help would be appreciated.
>
> TIA
>
> David L. Boardwine
> Senior Analyst
> Ohio Department of Development/ITO
> Phone (614) 752-4431
> [EMAIL PROTECTED]
>
>
>
>
>
>
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Get the mailserver that powers this list at http://www.coolfusion.com
FAQ: http://www.thenetprofits.co.uk/coldfusion/faq
Archives: http://www.mail-archive.com/cf-talk@houseoffusion.com/
Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists