当前位置: 首页 > 工具软件 > JSONSelect > 使用案例 >

json 数组 select默认选中

郭兴平
2023-12-01
	<tr>
			<td class="td">
							测试针卡1<input type="hidden" id="zk_flag" name="zk_flag" value="<c:choose><c:when test="${listZk != [] }">1</c:when><c:otherwise>0</c:otherwise></c:choose>"/>
						</td>
						<td class="td_f">
							<select id="tf_p4" name="tf_p4" class="input">
								<option value="">
									请选择针卡编号...
								</option>
								<c:forEach items="${listZk }" var="zk">
									<c:choose>
										<c:when test="${zk.tf_id == log.tf_p4 }">
											<option value="${zk.tf_id }" selected="selected">${zk.tf_name }</option>
										</c:when>
										<c:otherwise>
											<option value="${zk.tf_id }">${zk.tf_name }</option>
										</c:otherwise>
									</c:choose>
								</c:forEach>
							</select>
						</td>
						<td class="td">
							测试针卡2<input type="hidden" id="zk_flag2" name="zk_flag2" 
							value="<c:choose><c:when test="${listZk2 != [] }">1</c:when>
							<c:otherwise>0</c:otherwise>
							
						</c:choose>"/>
						</td>
						<td class="td_f">
							<select id="tf_p5" name="tf_p5" class="input">
								<option value="">
									请选择针卡编号...
								</option>
								<c:forEach items="${listZk2 }" var="zk">
									<c:choose>
										<c:when test="${zk.tf_id == log.tf_p5 }">
											<option value="${zk.tf_id}" selected="selected">${zk.tf_name }</option>
										</c:when>
										<c:otherwise>
											<option value="${zk.tf_id}">${zk.tf_name }</option>
										</c:otherwise>
									</c:choose>
								</c:forEach>
							</select>
						</td> 
					</tr>
					<tr>
						<td class="td">测试机类型</td>
						<td class="td_f">${test}
							<select class="input" id="tf_type" name="tf_type" onchange="changeSelect();">
								<option value="" >请选择测试机类型...</option>
								<c:forEach items="${listTest}" var="test" >
									<option value="${test}" <c:if test="${log.tf_type == test}"> selected="selected"</c:if>>${test}</option> 
								</c:forEach>
							</select>
						</td>
						<td class="td">测试机编号</td>
						<td class="td_f">
							<select class="input" id="tf_p3" name="tf_p3">
								<c:if test="${log.tf_p3 != ''}">
									<option value="${log.tf_p3 }" selected="selected">${log.tf_p3 }</option>
								</c:if>
							</select>
						</td>
					</tr>
 类似资料: