J
JS
I have this form in test.jsp, that consists of 3 drop/down menus (sel1, sel2
and sel3):
<body onload="createFirstMenu('sel1');">
<form name="sels" method="post" action="">
<select name="sel1" id="sel1" onchange="createSecondMenu('sel1','sel2',
'sel3');">
</select>
<select name="sel2" id="sel2" onchange="createThirdMenu('sel1','sel2',
'sel3');">
<option value="0">-- Vælg --</option>
</select>
<select name="sel3" id="sel3" onchange="update('sel1', 'sel2', 'sel3');">
<option value="0">--Vælg--</option>
</select>
</form>
In a javaScript I have the functions: createFirstMenu, createSecondMenu,
createThirdMenu and update.
If I choose something from sel1 "createSecondMenu" gets called with 3
arguments:
function createSecondMenu(sel){
var s = new Array(); // s holds the menus.
//s[0] = document.getElementById(arguments[0]); // s[0] contains the first
menu.
//s[1] = document.getElementById(arguments[1]); // s[1] contains the second
menu.
//s[2] = document.getElementById(arguments[2]); // s[2] contains the third
menu.
sel = s[1]; // sel now contains the second menu.
var choice1 = s[0].selectedIndex; // The index in the first menu.
var choice2 = s[1].selectedIndex; // The index in the second menu.
var choice3 = s[2].selectedIndex; // The index in the third menu.
resetMenu(sel);
}
But I just realized that choice1-3 contains the selected index from the 3
menus even when out comment the lines where I grap the arguments.
How can s[0], s[1] and s[2] contain the selected index from the right
drop/down menus when they don't contain a SELECT object???
and sel3):
<body onload="createFirstMenu('sel1');">
<form name="sels" method="post" action="">
<select name="sel1" id="sel1" onchange="createSecondMenu('sel1','sel2',
'sel3');">
</select>
<select name="sel2" id="sel2" onchange="createThirdMenu('sel1','sel2',
'sel3');">
<option value="0">-- Vælg --</option>
</select>
<select name="sel3" id="sel3" onchange="update('sel1', 'sel2', 'sel3');">
<option value="0">--Vælg--</option>
</select>
</form>
In a javaScript I have the functions: createFirstMenu, createSecondMenu,
createThirdMenu and update.
If I choose something from sel1 "createSecondMenu" gets called with 3
arguments:
function createSecondMenu(sel){
var s = new Array(); // s holds the menus.
//s[0] = document.getElementById(arguments[0]); // s[0] contains the first
menu.
//s[1] = document.getElementById(arguments[1]); // s[1] contains the second
menu.
//s[2] = document.getElementById(arguments[2]); // s[2] contains the third
menu.
sel = s[1]; // sel now contains the second menu.
var choice1 = s[0].selectedIndex; // The index in the first menu.
var choice2 = s[1].selectedIndex; // The index in the second menu.
var choice3 = s[2].selectedIndex; // The index in the third menu.
resetMenu(sel);
}
But I just realized that choice1-3 contains the selected index from the 3
menus even when out comment the lines where I grap the arguments.
How can s[0], s[1] and s[2] contain the selected index from the right
drop/down menus when they don't contain a SELECT object???