级联菜单

来源:互联网 发布:全球云计算销售额 编辑:程序博客网 时间:2024/05/16 23:45
 
<%@LANGUAGE="VBSCRIPT" CODEPAGE="936"%>
<!--#include file="inc/conn.asp"-->
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title>无标题文档</title>
</head>

<body><select   name="btype"   class="pp"   onChange="MM_jumpMenu('parent',this,0)">   
                                <%   
            sql   =   "select   [id],[type]   from   [btype]"   
            set   rs   =   conn.execute(sql)   
                    if   rs.eof   or   rs.bof   then   
                  response.write   "<option>-----</option>"     
            else   
                  while   not(rs.eof   or   rs.bof)     
                        response.write   ("<option   value='?sec="   &   rs(0)   &   "'")   
          if   cstr(rs(0))   =   request.querystring("sec")   then   
              response.write   "selected"   
                  end   if   
              response.write   (">"   &   rs(1)   &   "</option>")     
              rs.movenext   
                                wend   
              rs.movefirst     
                end   if   
 %>   
</select>   
<select   name="stype"   class="pp"   onChange="MM_jumpMenu('parent',this,0)">
                           
                          <%   
          if   rs.eof   or   rs.bof   then   
                                response.write   ("<option>--------</option>")   
                          else   
                          if   request.querystring("sec")   =   ""   then     
                                temp=rs(0)     
                          else   
                                temp   =   request.querystring("sec")   
                          end   if   
                                subsql   =   "select   [type]   from   [stype]   where   id='"&temp&"'"  
                                set   subrs   =   conn.execute(subsql)
                                  response.Write(subrs)
                                response.End()    
                          if   subrs.eof   or   subrs.bof   then   
                                response.write   ("<option>-----</option>")   
                          else   
                          while   not(subrs.eof   or   subrs.bof)   
                                response.write   ("<option   value="   &   subrs(0)   &   ">"   &   subrs(0)   &   "</option>")   
                                subrs.movenext   
                          wend   
                          end   if     
                          end   if   
    
                          subrs.close   
                          set   subrs   =   nothing   
                          rs.close   
                          set   rs   =   nothing   
                          conn.close   
                          set   conn   =   nothing   
                        %>   
                        </select>   
    
    
    
  <head>   
  <script   language="javascript"   type="text/javascript">   
  <!--   
        function   MM_jumpMenu(targ,selObj,restore){   //v3.0   
        eval(targ+".location='"+selObj.options[selObj.selectedIndex].value+"'");   
        if   (restore)   selObj.selectedIndex=0;   
        }   
  //-->   
  </script>   

</body>
</html>