select中通过点击option显示不同内容(js实现)

<html>
<head>
 
 
<script>function setChange()
{
if (document.f.selfs.value == "1")
{
document.all.tb1.style.display = "block";
document.all.tb2.style.display = "none";
 
}if (document.f.selfs.value == "2")
{
document.all.tb2.style.display = "block";
document.all.tb1.style.display = "none";
 
}
</script>
</head>
<body>
<form name=f>
<select name="selfs" size="1" onchange="setChange()">
<option selected>选择方式</option>
<option value="1">方式1</option>
<option value="2">方式2</option>
</select>
<table id='tb1' style='DISPLAY:none'> <tr><td>
方式1 方式1 方式1</td></tr>
</table>
<table id='tb2' style='DISPLAY:none'> <tr><td>
方式2 方式2方式2</td></tr>
</table>
</form>
</body>
</html>
posted @ 2013-05-25 14:34  风静海  阅读(848)  评论(0编辑  收藏  举报