I use one of two ways, but i prefer it to use the event object.


ex.
<select name="select1" id="select1"
>   blah blah
</select>

<select name="select2" id="select2"
>   blah blah
</select>

function setDept()
{
    mySelect = event.srcElement;
    if(mySelect.selectedIndex != 0) {
        myindex=mySelect.selectedIndex;
        var document.frm.hidselect.value = mySelect.options[myindex].value;
    }
    return true;
}


Tyler Clendenin
GSL Solutions

  _____  

From: cf coder [mailto:[EMAIL PROTECTED]
Sent: Thursday, March 25, 2004 5:36 AM
To: CF-Talk
Subject: help with drop-downs and onChange

I have two select boxes (drop-down boxes) in my form,
they both have a different onChange function. I want
both the drop downs to call the same function.

<select name="select1" id="select1"
>   blah blah
</select>

<select name="select2" id="select2"
>   blah blah
</select>

Hope I am making sense.

Here is my code.
function setDept1()
{
  if (document.frm.select1.selectedIndex != 0) {
     myindex=document.frm.select1.selectedIndex;
     var document.frm.hidselect.value =
document.frm.select1.options[myindex].value;
     return true;
    }
}

How do I pass the name of the drop-down box to the
function and then assign the selected option value to
a hidden variable. Can anybody please help me get
round this problem.
Best regards,
cfcoder

__________________________________
Do you Yahoo!?
Yahoo! Finance Tax Center - File online. File on time.
http://taxes.yahoo.com/filing.html
  _____
[Todays Threads] [This Message] [Subscription] [Fast Unsubscribe] [User Settings]

Reply via email to