Nope. The error I get is selectOne.1 is null or not an object, which is
essentially the same error I was getting before. It doesn't seem to be
changing the variable names to the real names of the select boxes that I'm
trying to pass in.
-d
----- Original Message -----
From: "jon hall" <[EMAIL PROTECTED]>
To: "CF-Community" <[EMAIL PROTECTED]>
Sent: Tuesday, March 04, 2003 9:28 AM
Subject: Re: grrr....javascript
> Assuming select1 and select2 are the names of the select boxes, and
> this is the first form on the page, this should work...no guarantees
> though :)
>
> function changeIt(select1, select2){
> selectOne = document.forms[0][select1];
> selectTwo = document.forms[0][select2];
>
> if (selectOne[1].selected)
> selectTwo.selectedIndex = 1;
> }
>
> --
> jon
> mailto:[EMAIL PROTECTED]
>
> Tuesday, March 4, 2003, 10:01:39 AM, you wrote:
> DS> Hi folks,
> DS> I'm in a foul mood this morning, and I'm trying to figure out this
javascript thing. That's a
> DS> 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).
> DS> <SCRIPT LANGUAGE="JavaScript" TYPE="text/javascript">
> DS> <!--
> DS> function changeIt(select1, select2){
> DS> var form = document.forms[0];
> DS> if (form.a1best[1].selected) {
> DS> form.a1when.selectedIndex = 1;}
> DS> }
> //-->>
> DS> </SCRIPT>
>
> DS> 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
> DS> 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?
>
> DS> ---------------------------------------------------------
> DS> Deanna Schneider
> DS> UWEX-Cooperative Extension
> DS> Interactive Media Developer
> DS>
>
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Archives: http://www.houseoffusion.com/cf_lists/index.cfm?forumid=5
Subscription:
http://www.houseoffusion.com/cf_lists/index.cfm?method=subscribe&forumid=5
Structure your ColdFusion code with Fusebox. Get the official book at
http://www.fusionauthority.com/bkinfo.cfm
Unsubscribe:
http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.5