跪求帮忙, 在Safari中动态创建下拉列表时所出现的问题

poisonbox 2008-11-26 12:10:13
各位高手:
我最近在做一个动态生成的下拉列表框,程序会根据用户在列表框1的选项来用javascript生成下拉列表框2。程序在IE/Firefox都运行正常,但在Safari3.0.3中就出现问题。问题是当动态生成列表框2时,列表框2的选项的某些区域会被黑色覆盖,详细请参考以下例子:
======================================================================================================
<html>
<head>
<title>Fail to repaint the dynamic options in dropdown menu</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
</head>

<body bgcolor="#FFFFFF">
<div align="center">
<h2>Fail to repaint the dynamic options in dropdown menu</h2>
</div>
<h3 align="center">In Safari 3.0.3 (522.15.5) running on Windows XP </h3>
<p><b>Instructions:</b></p>
<ol>
<li>Select the item2 in the List 1.</li>
<li>Click on the List 2 to view the options.</li>
<li>Select the item3 in the List 1.</li>
<li>Click on the list2 again to view the items. There will be black all around the options.</li>
</ol>

<p>Email me at poisonbox@126.com for more information or to suggest possible solutions.</p>
<h3 align="left">
<p> </p>
<script language="JavaScript">
function refreshOptions(list, list1)
{
if (list.selectedIndex == 1) {
list1.style.display='none';
list1.options.length = 0;
for (var i=list1.options.length; i<10; i++) {
list1.options[i] = new Option("0 Selected Index " + i, "");
}
list1.style.display='block';
} else if (list.selectedIndex == 2) {
list1.style.display='none';
list1.options.length = 0;
for (var i=list1.options.length; i<20; i++) {
list1.options[i] = new Option("1 Selected Index " + i, "");
}
list1.style.display='block';
}
}


</script>
</h3>
<form name="form1" method="post" action="">
<p align="center">
List 1:
<select name="select" onchange="refreshOptions(this.form.select, this.form.select1);">
<option>Default</option>
<option>item 2</option>
<option>item 3</option>
</select>
</p>
<p align="center">
List 2:
<select name="select1">
<option>Default</option>
</select>
</p>
</form>
<h3 align="center"> </h3>
</body>
</html>
======================================================================================================
...全文
61 1 打赏 收藏 转发到动态 举报
写回复
用AI写文章
1 条回复
切换为时间正序
请发表友善的回复…
发表回复
chunyou128 2008-11-26
  • 打赏
  • 举报
回复
没用过哎,帮顶。。。

87,992

社区成员

发帖
与我相关
我的任务
社区描述
Web 开发 JavaScript
社区管理员
  • JavaScript
  • 无·法
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧