81,120
社区成员




<html:select property="kindName" value="<bean:write name='f' property='kindName'/>">
<html:options collection="kindList" property="kindName" />
</html:select>
<script type="text/javascript">
function testSelect(){
var sele = document.getElementById("buttNum");
//3种方法自选
// 1,sele.value=sele.options(1).value;
// 2,sele.value="ccc";
//3,
sele.value=document.getElementById("DBvalue").value;
}
</script>
</head>
<body onload="testSelect()">
<html:form action="" name="form0">
<!-- value="ccc" value="aaa" 隐藏一个和 <html:option里面的一致就是你需要默认值:
value="<bean:write name='f' property='kindName'/>"
-->
<html:hidden property="DBvalue" id="DBvalue" value="bbb"></html:hidden>
<html:select value="buttNum" property="buttNum" id="buttNum">
<html:option value="aaa"></html:option>
<html:option value="bbb"></html:option>
<html:option value="ccc"></html:option>
</html:select>
<a onclick="testSelect()">点击test</a><br>
<bean:define id="kkName" name="f" property="kindName"></bean:define>
<td>
<html:select property="kindName" value="<%=kkName%>">
<html:options collection="kindList" property="kindName" />
</html:select>