O
Oliver Hauger
Hello,
In my html form I show a select-element and if this element is clicked I fill it
per JavaScript/DOM
with option-elements. I use the following code:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<title></title>
<script language="JavaScript" type="text/javascript">
function onWordlistSelect()
{
var selectElement = document.getElementById(9);
if (selectElement.getAttribute("populated") == "0")
{
for( var i = 0; i < 5; i++)
{
var optionElement = document.createElement( "option" );
var wordlistEntryName = "MyOption_" + i;
var textNode = document.createTextNode(wordlistEntryName);
optionElement.appendChild(textNode);
selectElement.appendChild(optionElement);
}
selectElement.setAttribute("populated", "1");
}
}
</script>
</head>
<body>
<select style="width:150px" size="1" populated="0" onClick="onWordlistSelect()"
id="9">
<option></option>
</select>
</body>
</html>
This works fine with Mozilla:
when I click on the dropdown it is opened and I can choose one of the added options.
BUT with IE I have the following behaviour:
when I click on the dropdown it is opened and closed immediately so I cannot
choose an entry.
I have to make a second click to see the options I've added and to select one of
them.
Does anyone have an idea how I could solve this problem?
Thanx in advance!
Oliver
In my html form I show a select-element and if this element is clicked I fill it
per JavaScript/DOM
with option-elements. I use the following code:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<title></title>
<script language="JavaScript" type="text/javascript">
function onWordlistSelect()
{
var selectElement = document.getElementById(9);
if (selectElement.getAttribute("populated") == "0")
{
for( var i = 0; i < 5; i++)
{
var optionElement = document.createElement( "option" );
var wordlistEntryName = "MyOption_" + i;
var textNode = document.createTextNode(wordlistEntryName);
optionElement.appendChild(textNode);
selectElement.appendChild(optionElement);
}
selectElement.setAttribute("populated", "1");
}
}
</script>
</head>
<body>
<select style="width:150px" size="1" populated="0" onClick="onWordlistSelect()"
id="9">
<option></option>
</select>
</body>
</html>
This works fine with Mozilla:
when I click on the dropdown it is opened and I can choose one of the added options.
BUT with IE I have the following behaviour:
when I click on the dropdown it is opened and closed immediately so I cannot
choose an entry.
I have to make a second click to see the options I've added and to select one of
them.
Does anyone have an idea how I could solve this problem?
Thanx in advance!
Oliver