Hallo,
folgende Seite klappt leider nicht mit IE:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title>multiselect test</title>
<script language="JavaScript" type="text/javascript">
<!--
function _NodeCreateSelectH(pAnchor, pszName, iSize)
{
var pElt;
// header
pElt = document.createElement("select");
if(null != pszName) pElt.setAttribute('name', pszName);
pElt.setAttribute("multiple", true);
pElt.setAttribute("size", iSize);
pAnchor.appendChild(pElt);
return pElt;
}
function _NodeCreateSelectOpt(pAnchor, iSelected, pszValue, pszTxt)
{
var pElt;
// option
pElt = document.createElement("option");
if(iSelected) pElt.setAttribute('selected', 'selected');
pElt.setAttribute('value', pszValue);
pElt.appendChild(document.createTextNode(pszTxt));
pAnchor.appendChild(pElt);
return pElt;
}
function CreateMultiList(pAnchor)
{
var i;
// create select
while(pAnchor.firstChild)
pAnchor.removeChild(pAnchor.firstChild); // remove defs
if(null != (pSel = _NodeCreateSelectH(pAnchor, "otest", 5)) )
{
for(i=0; i<10; i++)
{
_NodeCreateSelectOpt(pSel, 1, "opt " + i, "opttext " + i);
}
}
}
function start()
{
CreateMultiList(document.all.L0.parentNode);
}
//-->
</script>
</head>
<body onLoad="start()">
<select id="L0" style="width:100%" multiple size="6" name="Test">
<option value="1" selected>def 1</option>
<option value="2">def 2</option>
<option value="3" selected>def 3</option>
<option value="4">def 4</option>
<option value="5" selected>def 5</option>
<option value="6">def 6</option>
</select>
</body>
</html>
Der IE zeigt nur 1 Zeile und selektiert nur 1 Element.
Mit Opera und Mozilla funzt es.
Ich habe schon verschiedene Varianten probiert, auch mit setTimeout(). Weiss jemand Rat?