0
처음에는 CSS 문제라고 생각했지만 문제를 재현 할 수있는 작은 샘플을 만들었습니다. 값 :드롭 다운 목록 상자의 appendChild 메소드를 통해 추가 된 항목은 IE8에 표시되지 않습니다
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" >
<html xmlns="http://www.w3.org/1999/xhtml" >
<head>
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.5/jquery.min.js"></script>
<script type="text/javascript">
$(document).ready(function() {
alert("Thanks for visiting!");
var gridCommandBox = $('#GridCommands')[0];
if (gridCommandBox.options.length == 0) {
gridCommandBox.options.add(new Option("<Select Command>", ""));
var clipGroup = document.createElement("optgroup");
clipGroup.label = "Copy To Clipboard...";
clipGroup.appendChild(new Option("Value1", "Value1"));
clipGroup.appendChild(new Option("Value2", "Value2"));
clipGroup.appendChild(new Option("Value3", "Value3"));
gridCommandBox.appendChild(clipGroup);
}
});
</script>
</head>
<body>
<table>
<tr><td><select id="GridCommands"></select></td></tr>
</table>
</body>
</html>
모든 아이디어 : 당신이 IE8을 사용하는 경우 값 1, 2, 3이 표시되지 않습니다? 감사합니다 최대
귀하의 제안은 올바른 방향으로 나를 가리켰습니다. 여기 – Max
은 좋은 링크입니다 : http://blog.gridworlds.com/js/how-to-create-optgroups-in-javascript 고마워요! – Max