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> 
  • 相关阅读:
    span设置宽和高当没有内容的时候也可撑开
    span设置宽和高当没有内容的时候也可以撑开
    块级元素以及内联元素大总结
    内存泄露问题
    Sqlcompletefree
    运用SET ANSI_PADDING OFF创建某个字段为自增列的表,以及插入数据
    Sql Server中通配符
    sql server 2008查询窗口怎么显示行数
    sql server 2008语句中的go有什么用?
    SQL Server 2008 R2[ALTER]列属性修改
  • 原文地址:https://www.cnblogs.com/Dove/p/118248.html
Copyright © 2011-2022 走看看