原code如下
<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>
<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>