AJax技术

一个强健 实用的asp+ajax二级联动菜单(有演示和附源程序打包下载

字号+ 作者:H5之家 来源:H5之家 2017-04-05 10:01 我要评论( )

牛图库(niutuku.com)素材网提供一个强健,实用的asp+ajax二级联动菜单(有演示和附源程序打包下载),等设计素材免费下载。

主要代码如下:
index.asp

复制代码 代码如下:


<%@LANGUAGE="VBSCRIPT" CODEPAGE="936"%>
<!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" c />
<title>Ajax的二级联动by啊峰</title>
<script language="javascript" src="js.js"></script>
</head>
<body>
<h2><a href="http://yeahdown.com/">Ajax的二级联动by啊峰</a></h2>
<!--#include file="iconn.asp"-->
<%
Set afeng = Conn.Execute("select bigclassid,bigclassname from bigclass")
%>
<form method="post" action="">
<div>
<select >
<option value="0">选择一级分类</option>
<%If Not afeng.Eof then
Do While Not afeng.Eof
bigclassid= afeng("bigclassid")
bigclassname = afeng("bigclassname")%>
<option value="<%=bigclassid%>"><%=bigclassname%></option>
<%afeng.Movenext
Loop
End If
afeng.Close
Set afeng = Nothing
Conn.Close
Set Conn = Nothing%>
</select>
</div>
<div><select>
<option value="0">选择二级分类</option>
</select>
</div>
</form>
</body>
</html>


getsubcategory.asp文件:

复制代码 代码如下:


<%
Response.Charset="GB2312" '设置字符集 原默认为utf-8
bigclassid=safe(request.QueryString("bigclassid")) '非法字符过滤
If bigclassid<>"" Then
Set Re=New RegExp
Re.IgnoreCase=true
Re.Global=false
Re.Pattern = "^[0-9]{1,3}$"
If Not Re.Test(bigclassid) Then
Response.Write "非法参数"
Response.End
End If%>
<!--#include file="iconn.asp"-->
<%On error Resume Next
set p = conn.execute("select * from smallclass where bigclassid="&bigclassid&"")
If Err Then
Err.Clear
Response.Write "查询出错"
Response.End
End If
If Not p.Eof Then
html = "<select>"&vbnewline
Do While Not p.Eof
html = html&"<option value='"&p("smallclassid")&"'>"&p("smallclassname")&"</option>"&vbnewline
p.Movenext
Loop
html = html&"</select>"
Else
html = "<select><option value='0' selected>暂无小类</option></select>"
End If
p.Close
Set p = Nothing
Conn.Close
Set Conn = Nothing
Response.write html
html = ""
End If
%>


iconn.asp文件:

复制代码 代码如下:


<%
Set conn=server.CreateObject("adodb.connection")
db = "$#yeahdown.com@$$$@@%%.asp"
C & Server.MapPath(db)
On Error Resume Next
conn.open ConnStr
If Err Then
Err.Clear
Response.Write "<diverror"">连接数据库出错</div>"
Response.End
End If

Function safe(Str)
If Isnull(Str) Then
safe = ""
Exit Function
End If
Str = Replace(Str,Chr(0),"", 1, -1, 1)
Str = Replace(Str, """", """, 1, -1, 1)
Str = Replace(Str,"<","<", 1, -1, 1)
Str = Replace(Str,">",">", 1, -1, 1)
Str = Replace(Str, "script", "script", 1, -1, 0)
Str = Replace(Str, "SCRIPT", "SCRIPT", 1, -1, 0)
Str = Replace(Str, "Script", "Script", 1, -1, 0)
Str = Replace(Str, "script", "Script", 1, -1, 1)
Str = Replace(Str, "object", "object", 1, -1, 0)
Str = Replace(Str, "OBJECT", "OBJECT", 1, -1, 0)
Str = Replace(Str, "Object", "Object", 1, -1, 0)
Str = Replace(Str, "object", "Object", 1, -1, 1)
Str = Replace(Str, "applet", "applet", 1, -1, 0)
Str = Replace(Str, "APPLET", "APPLET", 1, -1, 0)
Str = Replace(Str, "Applet", "Applet", 1, -1, 0)
Str = Replace(Str, "applet", "Applet", 1, -1, 1)
Str = Replace(Str, "[", "[")
Str = Replace(Str, "]", "]")
Str = Replace(Str, """", "", 1, -1, 1)
Str = Replace(Str, "=", "=", 1, -1, 1)
Str = Replace(Str, "'", "''", 1, -1, 1)
Str = Replace(Str, "select", "select", 1, -1, 1)
Str = Replace(Str, "execute", "execute", 1, -1, 1)
Str = Replace(Str, "exec", "exec", 1, -1, 1)
Str = Replace(Str, "join", "join", 1, -1, 1)
Str = Replace(Str, "union", "union", 1, -1, 1)
Str = Replace(Str, "where", "where", 1, -1, 1)
Str = Replace(Str, "insert", "insert", 1, -1, 1)
Str = Replace(Str, "delete", "delete", 1, -1, 1)
Str = Replace(Str, "update", "update", 1, -1, 1)
Str = Replace(Str, "like", "like", 1, -1, 1)
Str = Replace(Str, "drop", "drop", 1, -1, 1)
Str = Replace(Str, "create", "create", 1, -1, 1)
Str = Replace(Str, "rename", "rename", 1, -1, 1)
Str = Replace(Str, "count", "count", 1, -1, 1)
Str = Replace(Str, "chr", "chr", 1, -1, 1)
Str = Replace(Str, "mid", "mid", 1, -1, 1)
Str = Replace(Str, "truncate", "truncate", 1, -1, 1)
Str = Replace(Str, "nchar", "nchar", 1, -1, 1)
Str = Replace(Str, "char", "char", 1, -1, 1)
Str = Replace(Str, "alter", "alter", 1, -1, 1)
Str = Replace(Str, "cast", "cast", 1, -1, 1)
Str = Replace(Str, "exists", "exists", 1, -1, 1)
Str = Replace(Str,Chr(13),"<br>", 1, -1, 1)
safe = Replace(Str,"'","''", 1, -1, 1)
End Function
%>


最后一个js.js

复制代码 代码如下:

 

1.本站遵循行业规范,任何转载的稿件都会明确标注作者和来源;2.本站的原创文章,请转载时务必注明文章作者和来源,不尊重原创的行为我们将追究责任;3.作者投稿可能会经我们编辑修改或补充。

相关文章
  • 蚂蚁社区,一个可以下载源码的神奇网站

    蚂蚁社区,一个可以下载源码的神奇网站

    2017-03-03 11:07

  • php判断一个请求是否是 AJAX 请求

    php判断一个请求是否是 AJAX 请求

    2017-02-26 08:03

  • 3款实用的在线JS代码工具(国外)

    3款实用的在线JS代码工具(国外)

    2017-02-25 11:04

  • 一个简单的ajax例子(带有清除ajax缓存的),苏州,网页设计建站技术

    一个简单的ajax例子(带有清除ajax缓存的),苏州,网页设计建站技术

    2017-02-22 16:01

网友点评