P
paulbradleysmith
Here's a simple script to update the contents of one select based on
the user's choice in a second select. It works fine in IE, but not at
all in Firefox. Can anyone shed light on the matter? Thanks.
Brad Smith
<html>
<head>
<title>Interests</title>
<meta http-equiv="Content-Type" content="text/html;
charset=iso-8859-1">
<script Language="JavaScript">
var i;
function AddItem(){
var oOption = document.createElement("OPTION");
oOption.text=document.myForm.SelectInterest.options[document.myForm.SelectInterest.selectedIndex].text;
oOption.value=document.myForm.SelectInterest.options[document.myForm.SelectInterest.selectedIndex].value;
document.myForm.Interests.add(oOption);
document.myForm.SelectInterest.selectedIndex=0;
}
</script>
<form name="myForm" method="post" action="">
<p> </p>
<p> </p>
<p> </p>
<p>
<select name="SelectInterest" onChange="AddItem()">
<option>Please make a selection</option>
<option value="1">One</option>
<option value="2">Two</option>
<option value="3">Three</option>
</select>
<br>
<br>
<select name="Interests" size="10" >
</select>
</p>
<input name="Clear List" type="button"
onClick="document.myForm.Interests.options.length = 0 " value="Clear
List">
</form>
</body>
</html>
the user's choice in a second select. It works fine in IE, but not at
all in Firefox. Can anyone shed light on the matter? Thanks.
Brad Smith
<html>
<head>
<title>Interests</title>
<meta http-equiv="Content-Type" content="text/html;
charset=iso-8859-1">
<script Language="JavaScript">
var i;
function AddItem(){
var oOption = document.createElement("OPTION");
oOption.text=document.myForm.SelectInterest.options[document.myForm.SelectInterest.selectedIndex].text;
oOption.value=document.myForm.SelectInterest.options[document.myForm.SelectInterest.selectedIndex].value;
document.myForm.Interests.add(oOption);
document.myForm.SelectInterest.selectedIndex=0;
}
</script>
<form name="myForm" method="post" action="">
<p> </p>
<p> </p>
<p> </p>
<p>
<select name="SelectInterest" onChange="AddItem()">
<option>Please make a selection</option>
<option value="1">One</option>
<option value="2">Two</option>
<option value="3">Three</option>
</select>
<br>
<br>
<select name="Interests" size="10" >
</select>
</p>
<input name="Clear List" type="button"
onClick="document.myForm.Interests.options.length = 0 " value="Clear
List">
</form>
</body>
</html>