代码如下:
复制代码 代码示例:
<div>
<select name="allTypeID" onChange="location.replace(this.options[this.selectedIndex].value)">
<%
for(int i=0;i<allTypeList.size();i++){
AllTypeForm form=(AllTypeForm)allTypeList.get(i);
%>
<option value="yd_ProfessionalCategorySelect.jsp?allTypeID=<%=form.getAllTypeID()%>"
<%
if(request.getParameter("allTypeID")!=null) {
if((form.getAllTypeID())==(Integer.valueOf(request.getParameter("allTypeID")))){
%>
selected="selected" //找到前一次所点下拉别表的名称
<%}} %>
>
<%=form.getAllTypeName() %>
</option>
<%} %>
</select>
</div>
把select部分抽取出来就是:
<select onChange="location.replace(this.options[this.selectedIndex].value)">
<option value="URL">URL</option>
<option value="URL">URL</option>
</select>