zoukankan      html  css  js  c++  java
  • 三级联动菜单 PENGHAO

    <!--#include file="conn.asp"--> 
    <% 
        dim bid,cid 
        bid 
    = request("bid")  'bid   大类id 
        cid 
    = request("cid")   'cid  中类id 

     '
    if bid="" then 
        'bid
    ="1" 
        'end 
    if 
     '
    if cid="" then 
        'cid
    ="1" 
        'end 
    if 
      
         set rs
    =server.createobject("adodb.recordset")   
         sql 
    = "select * from btype"    '表一  大类表 
         rs.open sql,conn,
    1,3 
         strOption1 
    = "<option value='' selected style='BACKGROUND-COLOR: #eeeeee; COLOR: #ff0000'>==请选择==</option>" 
               
    do while not rs.eof 
               
    if cstr(rs("id")) = cstr(bid) then 
                     strOption1 
    = strOption1 & "<option value='" & rs("id"& "' selected>" & rs("type"& "</option>" 
               
    else 
         
              strOption1 
    = strOption1 & "<option value='" & rs("id"& "'>" & rs("type"& "</option>" 
                
         end 
    if 
         rs.movenext       
                loop    
      
         rs.close 
         
         
    if bid <> "" then 
               sql 
    = "select * from mtype where bid=" & bid   '表二  中类表   bid==表一中的id 
             
         rs.open sql,conn,
    1,3 
               strOption2 
    = "<option value='' selected style='BACKGROUND-COLOR: #eeeeee; COLOR: #ff0000'>==请选择==</option>" 
        
               
    do while not rs.eof 
                     
    if cstr(rs("id")) = cstr(cid) then 
                           strOption2 
    = strOption2 & "<option value='" & rs("id"& "' selected>" & rs("type"& "</option>" 
                     
    else 
                           strOption2 
    = strOption2 & "<option value='" & rs("id"& "'>" & rs("type"& "</option>" 
                     end 
    if 
            rs.movenext 
               loop 
               rs.close 
         end 
    if 
         
         
    if cid <> "" then 
               sql 
    = "select * from stype where mid= " & cid  '表三   小类表  mid==表二的id 
               rs.open sql,conn,
    1,3 
               strOption3 
    = "<option value='' selected style='BACKGROUND-COLOR: #eeeeee; COLOR: #ff0000'>==请选择==</option>" 
               
    while not rs.eof 
               
    if cstr(rs("id")) = cstr(cid) then 
                           strOption3 
    = strOption3 & "<option value='" & rs("id"& "' selected>" & rs("type"& "</option>" 
                     
    else 
                           strOption3 
    = strOption3 & "<option value='" & rs("id"& "'>" & rs("type"& "</option>" 
                     end 
    if 
                     'strOption3 
    = strOption3 & "<option value='" & rs("id"& "'>" & rs("type"& "</option>" 
              
               rs.movenext 
               wend 
         rs.close 
         end 
    if 
         
    %> 
    <select onchange="changeb(this.value)" name="bid"><%=strOption1%></select> 
    <select onchange="change(this.value)" name="cid"><%=strOption2%></select> 
    <select name="typeid"><%=strOption3%></select> 
    <script language="javascript"> 
    <!-- 
         
    function changeb(bid){ 
               location.assign(
    "three.asp?bid=" + bid);   
         } 
         
         
    function change(cid){ 
               location.assign(
    "three.asp?bid=<%=bid%>&cid=" + cid);    
         } 
    --> 
    </script> 
  • 相关阅读:
    页面性能
    js运行机制
    渲染机制
    通信类
    js面向对象 继承
    原型
    [HEOI2016/TJOI2016]求和
    「NOIP2018 保卫王国」
    「LGP4719【模板】动态dp」
    多项式进阶操作
  • 原文地址:https://www.cnblogs.com/Dove/p/118248.html
Copyright © 2011-2022 走看看