Topic: 怎样改变<select>的选择值

  Print this page

1.怎样改变<select>的选择值 Copy to clipboard
Posted by: pc
Posted on: 2005-01-04 11:19

<select name=emp_type style="WIDTH: 115px" >
<option value=0 >无业</option><option value=2 >工人</option><option value=1 >干部</option><option value=3 >学生</option><option value=4 >其它</option>
</select>

从数据库中选择的值是"3",怎样才能让下拉框选中"学生",如果啊个朋友有例子,请给一个
谢谢

2.Re:怎样改变<select>的选择值 [Re: pc] Copy to clipboard
Posted by: dennisjl
Posted on: 2005-01-04 15:29

<%String temp = rs.getString("X");%>

<select name=emp_type style="WIDTH: 115px" >
<option value=0 <c:if test=${value=temp}>selected</c:if>>无业</option><option value=2 <c:if test=${value=temp}>selected</c:if>>工人</option><option value=1 <c:if test=${value=temp}>selected</c:if>>干部</option><option value=3 >学生</option><option value=4 <c:if test=${value=temp}>selected</c:if>>其它</option>
</select>


   Powered by Jute Powerful Forum® Version Jute 1.5.6 Ent
Copyright © 2002-2021 Cjsdn Team. All Righits Reserved. 闽ICP备05005120号-1
客服电话 18559299278    客服信箱 714923@qq.com    客服QQ 714923