标题:【求助】点击二级分类时只显示一级分类对应的二级分类
只看楼主
joen168
Rank: 1
等 级:新手上路
帖 子:1
专家分:0
注 册:2015-8-16
结帖率:0
已结贴  问题点数:20 回复次数:2 
【求助】点击二级分类时只显示一级分类对应的二级分类
说明:数据库相关表和字段
一级分类目录表 jle_class1 字段有 id,class1name,Class1Sort
二级分类目录表 jle_class2字段有 id,class2name,Class1 ,Class2Sort,其中Class1索引一级分类ID
信息文章表 jle_info 字段有id,in_class1,in_class2等,其中in_class1索引一级分类ID,和二级分类Class1 ,Class2索引二级分类ID
问题:点击二级分类时不能只显示一级分类对应的二级分类,而出现所有二级分类,点击一级分类后可以只显示对应的二级分类

目的:实现点击二级分类时只显示一级分类对应的二级分类,谢谢!


<!--#include file="../inc/conn.asp"-->
<!--#include file="Admin_Cookies.asp"-->
<!--#include file="Admin_DuoHai.asp"-->


<%
Action=CheckStr(trim(request("Action")))
if Action="Add" then
    Call Add()
elseif Action="Del" then
   Call Del()
elseif Action="Del2" then
   Call Del2()
else   
   Call Edit()
end if


Sub Add()
ID=CheckNum(Request("ID"))
IN_Class1=CheckStr(Trim(Request("Class1Name")))
IN_Class2=CheckStr(Trim(Request("Class2Name")))
IN_Title=CheckStr(Trim(Request("Title")))
IN_Area=CheckStr(Trim(Request("Area")))
IN_JiaGe=CheckStr(Trim(Request("JiaGe")))
IN_Name=CheckStr(Trim(Request("Name")))
IN_Tel=CheckStr(Trim(Request("Tel")))
days=CheckStr(Trim(Request("Sj")))
IN_QQ=CheckStr(Trim(Request("QQ")))
IN_Email=CheckStr(Trim(Request("Email")))
IN_DiZhi=CheckStr(Trim(Request("DiZhi")))
IN_Images=CheckStr(Trim(Request("Images")))
IN_ConTent=HTMLDecode(Request("ConTent"))
If IN_Class1="" Then
response.Write("<script>alert(""栏目1名称不能为空"");history.back();</script>")
response.End
elseif IN_Class2="" Then
response.Write("<script>alert(""栏目2名称不能为空"");history.back();</script>")
response.End
elseif IN_Title="" Then
response.Write("<script>alert(""信息标题不能为空"");history.back();</script>")
response.End
elseif len(IN_Title)>50 then
response.Write("<script>alert(""标题不能超过50个字符"");history.back();</script>")
response.End
elseif IN_Name="" then
response.Write("<script>alert(""联系人不能为空"");history.back();</script>")
response.End
elseif IN_ConTent="" then
response.Write("<script>alert(""信息内容不能为空"");history.back();</script>")
response.End
else
set rsc=server.CreateObject("ADODB.RECORDSET")
sql="select * from jle_info where id="&ID
rsc.open sql,conn,1,3
rsc("IN_Class1")=IN_Class1
rsc("IN_Class2")=IN_Class2
rsc("IN_Title")=IN_Title
rsc("IN_Area")=IN_Area
rsc("IN_ConTent")=IN_ConTent
IF IN_JiaGe<>"" Then
rsc("IN_JiaGe")=IN_JiaGe
end if
rsc("IN_Name")=IN_Name
IF IN_Tel<>"" Then
rsc("IN_Tel")=IN_Tel
end if
IF IN_QQ<>"" Then
rsc("IN_QQ")=IN_QQ
end if
IF IN_Email<>"" Then
rsc("IN_Email")=IN_Email
end if
IF IN_DiZhi<>"" Then
rsc("IN_DiZhi")=IN_DiZhi
end if
IF IN_Images<>"" Then
rsc("IN_Images")=IN_Images
end if
rsc.update
rsc.close
Set rsc=nothing
response.redirect("Admin_html.asp?Action=3&ID="&ID&"")
end if
End Sub


Sub Del()
        set rs=server.CreateObject("ADODB.RECORDSET")
        sql="select * from jle_info where IN_Html = '"&request("IN_Html")&"'"
        rs.open sql,conn,1,3
        dh_user=rs("in_user")
                if rs("in_User")<>"" then
                set rsC=server.CreateObject("ADODB.RECORDSET")
                sqlc="select * from jle_User where DH_User='" & DH_User &  "'"
                rsC.open sqlc,conn,1,3
                DH_Money=rsc("DH_Money")
                username=rsc("DH_User")
                        set rst=server.CreateObject("ADODB.RECORDSET")
                        sql1="select * from jifen"
                        rst.open sql1,conn,1,3
                        rst.addnew
                        rst("jieyu")=DH_Money-10
                        rst("jifen")="-10"
                        rst("shijian")="广告或垃圾信息被删除"
                        rst("user")=username
                        rst.update
                        rst.close
                        set rst=nothing
                rsc("DH_Money")=rsc("DH_Money")-10
                rsc.update
                rsc.close
                set rsc=nothing
                end if
        rs.close
        set rs=nothing
Set fso = Server.CreateObject("Scripting.FileSystemObject")
fso.DeleteFile server.mappath("../InfoList")&"\"&request("IN_Html"),true '此处需要服务器支持FSO删除权限!
sql="Delete From jle_info where IN_Html = '"&request("IN_Html")&"'"
conn.Execute(sql)
        
Call Alert("信息删除成功!","Admin_Info.Asp")
End Sub


Sub Del2()
id=trim(request("id"))
if id="" then
response.Write("<script>alert(""ID参数发生错误"");history.back();</script>")
else
set rs=server.CreateObject("ADODB.RECORDSET")
ArrayID = Split(id,",")
                        For i=0 TO ubound(ArrayID)
                                Conn.Execute ("Delete From [jle_info] Where id = " & CInt(ArrayID(i)))
                        Next
call Alert("删除成功!","Admin_Info.Asp")
rs.close
set rs=nothing
end if
End Sub


Sub Edit()
ID=CheckStr(trim(request("ID")))
set rs=server.CreateObject("ADODB.RECORDSET")
sql="select * from jle_info where id="&ID
rs.open sql,conn,1,1
if rs.eof and rs.bof then
   response.Write("<script>alert(""错误的访问,请返回!"");history.back();</script>")
   response.End
end if
%>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<link href="Admin_Style.css" rel="stylesheet" type="text/css">
<title>信息编辑</title>
</head>
<SCRIPT LANGUAGE="JavaScript">      
<!-- Begin
maxLen = 80;
function checkMaxInput(form) {
if (form.memo.value.length > maxLen)
form.remLen.value = 0;
else form.remLen.value = maxLen - form.memo.value.length;
}
//  End -->
</script>

'二楼还有
2015-08-16 12:39
ysf0181
Rank: 16Rank: 16Rank: 16Rank: 16
等 级:版主
威 望:55
帖 子:914
专家分:2385
注 册:2006-10-4
得分:10 
找源码,百度。你这个贴出来,没办法重点分写。

ASP讨论QQ群:251346273
2015-08-19 09:50
tlliqi
Rank: 19Rank: 19Rank: 19Rank: 19Rank: 19Rank: 19
等 级:贵宾
威 望:204
帖 子:15453
专家分:65956
注 册:2006-4-27
得分:10 
不错
2015-08-24 21:15



参与讨论请移步原网站贴子:https://bbs.bccn.net/thread-456426-1-1.html




关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.148356 second(s), 8 queries.
Copyright©2004-2024, BCCN.NET, All Rights Reserved