由于select选项较少,做的简单,
<select name="typeid" id="typeid">
<option value="-1">-请选择类型-</option>
<option value="grade">兑换等级</option>
<option value="money">兑换现金</option>
<option value="gift">兑换礼物</option>
</select>
<tr id="grade"></tr>
<tr id="money"></tr>
<tr id="gift"></tr>
<script>
$(document).ready(function(){
var alltypes = ['grade','money','gift'];
$("#typeid").change(function(){
var type = $(this).val();
for(i=0;i<alltypes.length;i++)
{
$("#"+alltypes[i]).hide();
$("#"+type).show();
}
});
});
</script>
将所有id存放一个数组中,然后遍历隐藏所有id,只显示选中值的id