I'm trying to change the options of a select element by setting its
innerHTML. Here's a demo case:
<html>
<head>
<script language="javascript" type="text/javascript">
function addOpts() {
var s = document.getElementById("s");
s.innerHTML = '<option>Opt1</option><option>Opt2</option>';
}
window.addEventListener('load', addOpts, false);
</script>
</head>
<body>
<form>
<select id="s">
</select>
</form>
</body>
</html>
In Konqueror this works as intended, the select now has two options,
"Opt1" and "Opt2". In Firefox, unfortunately, the code produces a
TextNode containing "Opt1Opt2" as the only child of the select element.
Is there a way to make Firefox behave as intended? If not, the next best
option is to swap the entire select element. This works, but I'd prefer
to change only the options.
Michael
--
Michael Schuerig You can twist perceptions
mailto:mi*****@schuerig.de Reality won't budge
http://www.schuerig.de/michael/ --Rush, Show Don't Tell