原code如下
所在版块:求学狮城 发贴时间:2008-06-17 13:35

用户信息
复制本帖HTML代码
高亮: 今天贴 X 昨天贴 X 前天贴 X 
<html>
<head>
<script type="text/javascript">
function show_hide(id) {
if (document.getElementById(id).style.display == 'block')
document.getElementById(id).style.display = 'none';
else if (document.getElementById(id).style.display == 'none')
document.getElementById(id).style.display = 'block';
document.getElementById('opt').value = 0;
}
</script>
</head>
<body>
<div style="height: 100px"></div>
<form>
<select id="opt" name="option">
<option id="opt0" value=0 style="display: block">default</option>
<option id="opt1" value=1 style="display: block">first option</option>
<option id="opt2" value=2 style="display: block">second option</option>
<option id="opt3" value=3 style="display: block">third option</option>
<option id="opt4" value=4 style="display: block">fourth option</option>
</select>
</form>
<table>
<tr><td>
<a onclick="show_hide('opt1')">show/hide first option</a>
</td></tr><tr><td>
<a onclick="show_hide('opt2')">show/hide second option</a>
</td></tr><tr><td>
<a onclick="show_hide('opt3')">show/hide third option</a>
</td></tr><tr><td>
<a onclick="show_hide('opt4')">show/hide fourth option</a>
</td></tr>
</table>
<div style="height: 800px"></div>
</body>
</html>
.
欢迎来到华新中文网,踊跃发帖是支持我们的最好方法!

This page is intentionally left blank
 相关帖子 我要回复↙ ↗回到正文
求html.option.style.display IE的解决办法 icky   (290 bytes , 721reads )
原code如下 icky   (1189 bytes , 259reads )
建议用JS的framework, JQuery, Prototype 都不错 moon9shine   (1 bytes , 370reads )
这是IE的一个bug, 有几个workaround的方法 大树下   (1482 bytes , 401reads )
阁下真乃神人也 icky   (0 bytes , 262reads )