select 刷新后保留值

<script language="javascript" type="text/javascript">
var GetDayTimeValue='<%=DayTimeNum %>'; //注:GetDayTimeValue值是接受后得到的值
window.onload = intonload;
function intonload()
{
   var oSel = document.getElementById('DayTime');
   for (var i = 0; i < oSel.length; i++)
   {
     if (GetDayTimeValue == oSel[i].value)
     {
       oSel[i].selected = true;
       break;
     }
   }
}
</script>                

<select id="DayTime" name="DayTime" style="width: 155px" >   
     <option value="0">不限</option>
     <option value="1">最近一天</option>
     <option value="3">最近三天</option>
     <option value="7">最近一周</option>
     <option value="15">最近半个月</option>
     <option value="31">最近一个月</option>
     <option value="62">最近两个月</option>
</select>

posted @ 2008-10-05 15:04  郑希强  阅读(995)  评论(0编辑  收藏  举报