J
JS
I have made a function createFirstMenu where I call "resetMenu" in a
JavaScript. But nothing happens when I call resetMenu.
function createFirstMenu(sel){
sel = document.getElementById('sel1');
resetMenu(sel);
}
function resetMenu(sel){
sel.length = 0;
opt = document.createElement('OPTION');
sel.appendChild(opt);
opt.value = "";
opt.text = "-- Choose--";
}
This is the form where I call createFirstMenu when the page loads.
<body onload="createFirstMenu('sel1');">
<form name="sels" method="post" action="">
<select name="sel1" id="sel1" onchange="createSecondMenu('sel1','sel2');">
</select>
<select name="sel2" id="sel2" onchange="createThirdMenu('sel1','sel2',
'sel3');">
<option value="">-- Vælg --</option>
</select>
<select name="sel3" id="sel3">
<option value="">--Vælg--</option>
</select>
<input name="search" type="text" id="search">
<input type="submit" name="Submit" value="Søg">
</form>
Hope someone can help!
JavaScript. But nothing happens when I call resetMenu.
function createFirstMenu(sel){
sel = document.getElementById('sel1');
resetMenu(sel);
}
function resetMenu(sel){
sel.length = 0;
opt = document.createElement('OPTION');
sel.appendChild(opt);
opt.value = "";
opt.text = "-- Choose--";
}
This is the form where I call createFirstMenu when the page loads.
<body onload="createFirstMenu('sel1');">
<form name="sels" method="post" action="">
<select name="sel1" id="sel1" onchange="createSecondMenu('sel1','sel2');">
</select>
<select name="sel2" id="sel2" onchange="createThirdMenu('sel1','sel2',
'sel3');">
<option value="">-- Vælg --</option>
</select>
<select name="sel3" id="sel3">
<option value="">--Vælg--</option>
</select>
<input name="search" type="text" id="search">
<input type="submit" name="Submit" value="Søg">
</form>
Hope someone can help!