you can pass a reference the current object in the onChange event, as
"this".

<select... >
function setDept1(selectbox) {
alert selectbox.selectedIndex;
}

Untested code, a shot from the hip -- but you get the concept.. ?
:)

/Hugo

-------------------------------------------------------------
Hugo Ahlenius                  E-Mail: [EMAIL PROTECTED]
Project Officer                Phone:            +46 8 230460
UNEP GRID-Arendal              Fax:              +46 8 230441
Stockholm Office               Mobile:         +46 733 467111
                               WWW:       http://www.grida.no
-------------------------------------------------------------



| -----Original Message-----
| From: cf coder [mailto:[EMAIL PROTECTED]
| Sent: Thursday, March 25, 2004 11:36
| 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