kenlistian

勤学多思

  IT博客 :: 首页 :: 新随笔 ::  :: 聚合  :: 管理 ::
  412 随笔 :: 0 文章 :: 23 评论 :: 0 Trackbacks

通过select中属性selected 来定义初值。
  如下:
 <select size="1" name="item" onChange="location=this.options[this.selectedIndex].value">
            <option value="?s_ServiceId=0" <%If s_ServiceId=0 Then%>selected <%End if%>>全部</option>   
              <%
      Set rs_lei = server.createobject("adodb.recordset")                                           
        sql = "select * from tb"                                           
        rs_lei.open sql,conn,1,1                                         

      do while not rs_lei.eof
          if rs_lei("s_ServiceId") <> 0 Then
      %>

      <option value="?s_ServiceId=<%=rs_lei("s_ServiceId")%>" <%If s_ServiceId=rs_lei("s_ServiceId") Then%>selected <%End if%>><%=rs_lei("s_Service")%></option>

            <%end if
         rs_lei.movenext                                     
              loop                                               
           rs_lei.close                                      
           set rs_lei = Nothing
         %>
 </select>

posted on 2008-04-21 14:55 kenlistian 阅读(1430) 评论(0)  编辑 收藏 引用 所属分类: WEB
只有注册用户登录后才能发表评论。