<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<script type="text/javascript" src="jquery.js"></script>
<title>下拉菜单中控制显示或隐藏</title>
</head>
<body>
<form>
<table>
<thead>
<tr>
<td width="9%" align="right" nowrap>车辆选择</td>
<td colspan="5" align="left">
<select name="vinchoose" id="vinchoose">
<option value="凯美瑞">凯美瑞</option>
<option value="雷凌">雷凌</option>
<option value="保时捷">保时捷</option>
<option value="雷诺">雷诺</option>
</select>
</td>
</tr>
</thead>
<tbody id="d1" style="">
<tr>
<td width="9%" align="right" nowrap>车辆昵称</td>
<td colspan="2">
<input type="text" id="id" value="1" disabled>
</td>
<td width="9%" align="right" nowrap>VIN</td>
<td colspan="2">
<input type="text" id="qd" value="${model.VINNO}" disabled>
</td>
</tr>
<tr>
<td width="9%" align="right" nowrap>车牌号</td>
<td colspan="2">
<input type="text" id="id" value="2" disabled>
</td>
<td width="9%" align="right" nowrap>发动机号</td>
<td colspan="2">
<input type="text" id="qd" value="${model.VHCENGINE}" disabled>
</td>
</tr>
<tr>
<td width="9%" align="right" nowrap>车型</td>
<td colspan="2">
<input type="text" id="id" value="${model.VEHICLENAME}" disabled>
</td>
<td width="9%" align="right" nowrap>SFX</td>
<td colspan="2">
<input type="text" id="qd" value="${model.SFX}" disabled>
</td>
</tr>
<tr>
<td width="9%" align="right" nowrap>车辆里程</td>
<td colspan="2">
<input type="text" id="id" value="${model.mileage}" disabled>
</td>
<td width="9%" align="right" nowrap>车辆里程最近更新时间</td>
<td colspan="2">
<input type="text" id="qd" value="${model.UPDATE_YEAR}-${model.UPDATE_MONTH}" disabled>
</td>
</tr>
</tbody>
<tbody id="d2" style="display:none;">
<tr>
<td width="9%" align="right" nowrap>车辆昵称</td>
<td colspan="2">
<input type="text" id="id" value="22222" disabled>
</td>
<td width="9%" align="right" nowrap>VIN</td>
<td colspan="2">
<input type="text" id="qd" value="22222" disabled>
</td>
</tr>
<tr>
<td width="9%" align="right" nowrap>车牌号</td>
<td colspan="2">
<input type="text" id="id" value="${model.REGISTERNO}" disabled>
</td>
<td width="9%" align="right" nowrap>发动机号</td>
<td colspan="2">
<input type="text" id="qd" value="${model.VHCENGINE}" disabled>
</td>
</tr>
<tr>
<td width="9%" align="right" nowrap>车型</td>
<td colspan="2">
<input type="text" id="id" value="${model.VEHICLENAME}" disabled>
</td>
<td width="9%" align="right" nowrap>SFX</td>
<td colspan="2">
<input type="text" id="qd" value="${model.SFX}" disabled>
</td>
</tr>
<tr>
<td width="9%" align="right" nowrap>车辆里程</td>
<td colspan="2">
<input type="text" id="id" value="${model.mileage}" disabled>
</td>
<td width="9%" align="right" nowrap>车辆里程最近更新时间</td>
<td colspan="2">
<input type="text" id="qd" value="${model.UPDATE_YEAR}-${model.UPDATE_MONTH}" disabled>
</td>
</tr>
</tbody>
<tbody id="d3" style="display:none;">
<tr>
<td width="9%" align="right" nowrap>车辆昵称</td>
<td colspan="2">
<input type="text" id="id" value="333333" disabled>
</td>
<td width="9%" align="right" nowrap>VIN</td>
<td colspan="2">
<input type="text" id="qd" value="333333" disabled>
</td>
</tr>
<tr>
<td width="9%" align="right" nowrap>车牌号</td>
<td colspan="2">
<input type="text" id="id" value="${model.REGISTERNO}" disabled>
</td>
<td width="9%" align="right" nowrap>发动机号</td>
<td colspan="2">
<input type="text" id="qd" value="${model.VHCENGINE}" disabled>
</td>
</tr>
<tr>
<td width="9%" align="right" nowrap>车型</td>
<td colspan="2">
<input type="text" id="id" value="${model.VEHICLENAME}" disabled>
</td>
<td width="9%" align="right" nowrap>SFX</td>
<td colspan="2">
<input type="text" id="qd" value="${model.SFX}" disabled>
</td>
</tr>
<tr>
<td width="9%" align="right" nowrap>车辆里程</td>
<td colspan="2">
<input type="text" id="id" value="${model.mileage}" disabled>
</td>
<td width="9%" align="right" nowrap>车辆里程最近更新时间</td>
<td colspan="2">
<input type="text" id="qd" value="${model.UPDATE_YEAR}-${model.UPDATE_MONTH}" disabled>
</td>
</tr>
</tbody>
<tbody id="d4" dd style="display:none;">
<tr>
<td width="9%" align="right" nowrap>车辆昵称</td>
<td colspan="2">
<input type="text" id="id" value="444444" disabled>
</td>
<td width="9%" align="right" nowrap>VIN</td>
<td colspan="2">
<input type="text" id="qd" value="44444" disabled>
</td>
</tr>
<tr>
<td width="9%" align="right" nowrap>车牌号</td>
<td colspan="2">
<input type="text" id="id" value="${model.REGISTERNO}" disabled>
</td>
<td width="9%" align="right" nowrap>发动机号</td>
<td colspan="2">
<input type="text" id="qd" value="${model.VHCENGINE}" disabled>
</td>
</tr>
<tr>
<td width="9%" align="right" nowrap>车型</td>
<td colspan="2">
<input type="text" id="id" value="${model.VEHICLENAME}" disabled>
</td>
<td width="9%" align="right" nowrap>SFX</td>
<td colspan="2">
<input type="text" id="qd" value="${model.SFX}" disabled>
</td>
</tr>
<tr>
<td width="9%" align="right" nowrap>车辆里程</td>
<td colspan="2">
<input type="text" id="id" value="${model.mileage}" disabled>
</td>
<td width="9%" align="right" nowrap>车辆里程最近更新时间</td>
<td colspan="2">
<input type="text" id="qd" value="${model.UPDATE_YEAR}-${model.UPDATE_MONTH}" disabled>
</td>
</tr>
</tbody>
</table>
</form>
<script type="text/javascript">
var dd="";
var map = {"凯美瑞":"d1", "雷凌":"d2", "保时捷":"d3","雷诺":"d4"};
$("#vinchoose").bind("change", function(){
var divId = map[this.value];
document.getElementById("d1").style.display="none";
document.getElementById(divId).style.display="";
if(dd!=""){
if(dd!=divId){
document.getElementById(dd).style.display="none";
}
}
dd=divId;
}
);
</script>
<body>
</html>
注意:使用div做的话则不能放在<table>中,所以使用<tbody>来实现效果
下拉框选中值对应切换内容的效果
最新推荐文章于 2022-08-10 00:23:19 发布