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
Signup for the Fusion Authority news alert and keep up with the latest news in 
ColdFusion and related topics. http://www.fusionauthority.com/signup.cfm

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

Reply via email to