Phi, that is a bug specific to Internet Explorer, when you set the
innerHTML property of the
Select object, the changes do not take effect correctly.
If you must use
innerHTML, a workaround is to use a
Div object to wrap the SELECT element and then set the
innerHTML property for the
Div object.
Don't know XAM's code, not really interested either but I can give you an example:
HTML Code:
<html>
<head>
<title>My Example</title>
<script language="Javascript">
var origDivHTML;
function init()
{
origDivHTML = myDiv.innerHTML;
}
function setValues()
{
var oldinnerHTML = "your original innerHTML: " + yourDiv.innerHTML ;
alert(oldinnerHTML);
yourDiv.innerHTML = origDivHTML;
var curinnerHTML = "your current innerHTML: " + yourDiv.innerHTML ;
alert(curinnerHTML);
}
</script>
</head>
<body onload="init()">
<div id="myDiv">
<select name="firstSelect" size="1" >
<option>11111</option>
<option>22222</option>
<option>33333</option>
</select>
</div>
<div id="yourDiv">
<select name="secondSelect" size="1" >
<option>aaaa</option>
<option>bbbb</option>
<option>cccc</option>
</select>
</div>
<button onclick = "setValues();">click me to set the values</button>
</body>
</html>
Or you could follow this guide:
http://domscripting.com/blog/display/99
The use of innerHTML isn't recommended by W3C either.
Cheers!