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.getEle mentById('sel1' );
resetMenu(sel);
}
function resetMenu(sel){
sel.length = 0;
opt = document.create Element('OPTION ');
sel.appendChild (opt);
opt.value = "";
opt.text = "-- Choose--";
}
This is the form where I call createFirstMenu when the page loads.
<body onload="createF irstMenu('sel1' );">
<form name="sels" method="post" action="">
<select name="sel1" id="sel1" onchange="creat eSecondMenu('se l1','sel2');">
</select>
<select name="sel2" id="sel2" onchange="creat eThirdMenu('sel 1','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.getEle mentById('sel1' );
resetMenu(sel);
}
function resetMenu(sel){
sel.length = 0;
opt = document.create Element('OPTION ');
sel.appendChild (opt);
opt.value = "";
opt.text = "-- Choose--";
}
This is the form where I call createFirstMenu when the page loads.
<body onload="createF irstMenu('sel1' );">
<form name="sels" method="post" action="">
<select name="sel1" id="sel1" onchange="creat eSecondMenu('se l1','sel2');">
</select>
<select name="sel2" id="sel2" onchange="creat eThirdMenu('sel 1','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!
Comment