html下拉菜单提交后保留选中值

html下拉菜单提交后保留选中值

<?php   
    $select_value = isset($_GET['xq']) ? $_GET['xq'] : '';  
?>  
<form action="?" method="get" name="form1" id="form1" >
<td>学期:</td><td><select name="xq" id="xq" style="position: absolute"class="choose" onmousedown="if(this.options.length>6){this.size=7}" onblur="this.size=0" onchange="this.size=0">
         <option value="2017-2018学年春季学期" <?php echo $select_value == '2017-2018学年春季学期' ? 'selected' : ''?> >2017-2018学年春季学期</option>
         <option value="2017-2018学年冬季学期" <?php echo $select_value == '2017-2018学年冬季学期' ? 'selected' : ''?> >2017-2018学年冬季学期</option>
         <option value="2017-2018学年秋季学期" <?php echo $select_value == '2017-2018学年秋季学期' ? 'selected' : ''?> >2017-2018学年秋季学期</option>           
</select>
</td>
<input type="submit" value="查询"  />
</form>




jsp页面提交后,下拉菜单选不中

10-12

为何选中2号机,点确定按钮页面提交后,rn机组选项仍为1号机,各位大侠给点建议。。。,能否不用javascript函数解决问题,多谢rnrnrn<%@ page language="java" contentType="text/html; charset=gb2312"pageEncoding="gb2312"%>rn<%@ page import = "java.util.Date" %>rnrnrn<%rnrn Date date=new Date();rn int currentY = date.getYear()+1900;rn int currentM = date.getMonth()+1;rn int currentD = date.getDate();rnrnrn String[][] names= "1号机","1001","2号机","1002";rn int unitNum=names.length;rnrn String sYear=request.getParameter("year");rn String sMonth=request.getParameter("month");rn String sDay=request.getParameter("day");rn String sUnitId=request.getParameter("bidunit_id");rn rn if (sYear==null) rn sYear=String.valueOf(currentY);rn rn if (sMonth==null) rn sMonth=String.valueOf(currentM);rn rn if (sDay==null) rn sDay=String.valueOf(currentD);rn rnrn if (sUnitId==null) rn System.out.println("sUnitId null......................");rn sUnitId=names[0][1]; //第一次默认取第一个机组idrn rn String sDate=sYear+"-"+sMonth+"-"+sDay;rn int year = Integer.parseInt(sYear);rn int month =Integer.parseInt(sMonth);rn int day=Integer.parseInt(sDay);rn rn%>rnrnrn rn rn rn rn rn rn rn rn 时间:rn rn<%rn for (int i=currentY - 5;i<=currentY + 3;i++) rn%>rn rn selectedrn<% rn rn%>rn > <%=i%>rn rn<%rn rn%> rn 年rn rn<%rn for (int j = 1 ; j <= 12; j++) rn%> rn rn selected rn<% rn rn%>rn ><%=j%>rn rn<%rn rn%> rn 月rn rnrn<%rn for (int k = 1 ; k <= 31; k++) rn%> rn rn selected rn<% rn rn%>rn ><%=k%>rn rn<%rn rn%> rn 日rn rn rn 机组:rn rn<% rn for (int l=0;lrn rn <%=names[l][0]%>rn rn<% rn else rn%>rn ">rn <%=names[l][0]%>rn rn<%rn rn%> rn rn rn rn rn rn rn rn rn 单位:兆瓦rn rn rn rn rn rn rn rn rn

没有更多推荐了,返回首页

私密
私密原因:
请选择设置私密原因
  • 广告
  • 抄袭
  • 版权
  • 政治
  • 色情
  • 无意义
  • 其他
其他原因:
120
出错啦
系统繁忙,请稍后再试