Yes, as Matthew pointed out you need to pass the a reference to the object
you want to use, other wise you where just passing a string and would need
to use the string to find the object you wanted as suggested in another
reply.  I don't know where the onChange code is located, but if it is in the
checkbox control you are trying to reference you can use "this" to reference
that control.  Something like

onChange="changeIt(this, document.form.a1when)"

Saves a lot of typing sometimes.

Ian 
BloodSource
Sacramento, CA 

-----Original Message-----
From: Deanna Schneider [mailto:[EMAIL PROTECTED]
Sent: Tuesday, March 04, 2003 8:26 AM
To: CF-Community
Subject: Re: grrr....javascript


Woo hoo! That works. Thanks Matthew. I can never remember all the
intricacies of javascript, cause I just don't use it enough.

-Deanna

----- Original Message -----
From: "Matthew Small" <[EMAIL PROTECTED]>
To: "CF-Community" <[EMAIL PROTECTED]>
Sent: Tuesday, March 04, 2003 9:36 AM
Subject: RE: grrr....javascript


> I think you have to pass the entire scoped object to the function:
>
> function changeIt(select1, select2){
> if (select1[1].selected) {
> select2.selectedIndex = 1;}
>
> and call it like this:
>
> onChange="changeIt(document.form.a1best, document.form.a1when)"
>
> I have the hardest time remembering the DOM but I am pretty sure that
> the correct thing to do is pass the entire scoped object.
>
>
> Matthew Small
> IT Supervisor
> Showstopper National Dance Competitions
> 3660 Old Kings Hwy
> Murrells Inlet, SC 29576
> 843-357-1847
> http://www.showstopperonline.com
>
> -----Original Message-----
> From: Deanna Schneider [mailto:[EMAIL PROTECTED]
> Sent: Tuesday, March 04, 2003 10:02 AM
> To: CF-Community
> Subject: grrr....javascript
>
> Hi folks,
> I'm in a foul mood this morning, and I'm trying to figure out this
> javascript thing. That's a
> bad combination for me. So, I decided to ask for help. Here's the basic
> script that works (with the hardcoded names of the select boxes).
> <SCRIPT LANGUAGE="JavaScript" TYPE="text/javascript">
> <!--
> function changeIt(select1, select2){
>  var form = document.forms[0];
>  if (form.a1best[1].selected) {
>   form.a1when.selectedIndex = 1;}
>  }
> //-->
> </SCRIPT>
>
> Basically, I want to be able to change the second select box if they
> choose the first item in the first select box. But, when I try use the
> variable names (select1, select2), it fails. Shouldn't I be able to call
> the script like so: onChange="changeIt(a1best, a1when)" and change the
> hardcoded references in the script above to select1 and select2 and have
> it work?
>
> ---------------------------------------------------------
> Deanna Schneider
> UWEX-Cooperative Extension
> Interactive Media Developer
>
> 

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Archives: http://www.houseoffusion.com/cf_lists/index.cfm?forumid=5
Subscription: 
http://www.houseoffusion.com/cf_lists/index.cfm?method=subscribe&forumid=5
Get the mailserver that powers this list at http://www.coolfusion.com

                                Unsubscribe: 
http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.5
                                

Reply via email to