基于asp+ajax和数据库驱动的二级联动菜单

index.asp 页面代码

复制代码 代码如下:

set cmd = conn.execute("select bigclassid,bigclassname from bigclass")

tempid=cmd("bigclassid")

%>

if not cmd.eof then

do while not cmd.eof

bigclassid= cmd("bigclassid")

bigclassname = cmd("bigclassname")

%>

cmd.movenext

loop

end if

cmd.close

set cmd = nothing

%>

set cxd = conn.execute("select * from smallclass where bigclassid=" & tempid)

if not cxd.eof then

do while not cxd.eof

smallclassid= cxd("smallclassid")

smallclassname = cxd("smallclassname")%>

cxd.movenext

loop

cxd.close

set cxd = nothing

else

html = "暂无小类"

response.write html

end if

%>

ajax.js 代码

复制代码 代码如下:

// JavaScript Document

function createxmlhttp()

{

xmlhttpobj = false;

try{

xmlhttpobj = new XMLHttpRequest;

}catch(e){

try{

xmlhttpobj=new ActiveXObject("MSXML2.XMLHTTP");

}catch(e2){

try{

xmlhttpobj=new ActiveXObject("Microsoft.XMLHTTP");

}catch(e3){

xmlhttpobj = false;

}

}

}

return xmlhttpobj;

}

function getsubcategory(bigclassid){

if(bigclassid==0){

document.getElementById("subclass").innerHTML="选择二级分类";

return;

};

var xmlhttpobj = createxmlhttp();

if(xmlhttpobj){//如果创建对象xmlhttpobj成功

xmlhttpobj.onreadystatechange=handle;

xmlhttpobj.open('get',"getsubcategory.asp?bigclassid="+bigclassid+"&number="+Math.random(),true);//get方法 加个随机数。

xmlhttpobj.send(null);

}

}

function handle(){//客户端监控函数

//if(xmlhttpobj.readystate==4){//服务器处理请求完成

if(xmlhttpobj.status==200){

//alert('ok');

var html = xmlhttpobj.responseText;//获得返回值

document.getElementById("subclass").innerHTML=html;

}else{

document.getElementById("subclass").innerHTML="对不起,您请求的页面有问题...";

}

//}

//else{

//document.getElementById("subclass").innerHTML=xmlhttpobj.readystate;//服务器处理中

//}

//}

}

getsubcategory.asp 代码

复制代码 代码如下:

response.charset="gb2312"

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%>

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 = ""&vbnewline

do while not p.eof

html = html&""&p("smallclassname")&""&vbnewline

p.movenext

loop

html = html&""

else

html = "暂无小类"

end if

p.close

set p = nothing

conn.close

set conn = nothing

response.write html

html = ""

end if

%>相关阅读:

关于B/S判断浏览器断开的问题讨论

HTML5还有多远 开发者的机会

asp下实现格式化文件大小以MB显示的函数

用JavaScript实现全局替换,解决$等特殊符号的难题[

搜索和替换文件或目录的一个好类--很实用

asp 空值测试判断函数

基于Jquery与WebMethod投票功能实现代码

PHP学习宝典-第六章(续篇)

Linux操作系统最强大的功能是什么

点选TOP后并不是直接跳到页顶的,而是滚动上去的

math.vbs 自然数n的n次方的的和或积的级数

javascript dragable的Move对象

attachEvent的使用方法与传递参数[IE|firefox]

用javascript实现的仿Flash广告图片轮换效果

asp+ajax菜单,AJAX_基于asp+ajax和数据库驱动的二级联动菜单,index.asp 页面代码 复制代码 代 - phpStudy...相关推荐

  1. 二级联动菜单ajax刷新,jquery json ajax 二级联动菜单实例

    本文实例讲述了jquery json ajax 二级联动菜单.分享给码农们参考,具体如下: 后台Handler.ashx using System; using System.Web; using S ...

  2. php js 二级联动_PHP+ajax实现二级联动菜单功能示例

    本文实例讲述了PHP+ajax实现二级联动菜单功能.分享给大家供大家参考,具体如下: 如何实现二级联动 工作原理 二级联动在开发中是比较常见的一个技术点,它主要运用了JS的局部刷新技术ajax,不同于 ...

  3. java ajax 联动菜单_二级联动菜单代码(AJAX JAVA).

    二级联动菜单代码(AJAX+JAVA)珍藏 [java] pageEncoding="UTF-8"%> 二级菜单联动演示 var req; window.οnlοad=fun ...

  4. 利用ajax实现二级联动下拉框6,Ajax实现二级联动菜单

    本文实例为大家分享了Ajax二级联动菜单的具体代码,供大家参考,具体内容如下 index.jsp 二级菜单联动演示 var req; window.οnlοad=function() {//页面加载时 ...

  5. 一款基于jquery和css3的响应式二级导航菜单

    今天给大家分享一款基于jquery和css3的响应式二级导航菜单,这款导航是传统的基于顶部,鼠标经过的时候显示二级导航,还采用了当前流行的响应式设计.效果图如下: 在线预览   源码下载 实现的代码. ...

  6. HTML实现二级联动下拉菜单,基于jquery的二级联动菜单实现代码

    jQuery 1.3.2 简单实现select二级联动 jQuery 二级联动 $(document).ready(function(){ $("#province").chang ...

  7. 二级联动菜单,简单实现

    /*** jQuery Linkage Menu** Copyright 2014, sunyingyuan* QQ: 1586383022* Email: yingyuansun@163.com** ...

  8. php 二级下拉菜单源码,二级联动菜单-PHP源码

    <script>ec(2);<script> 二级联动下拉菜单 自家用的 js二级联动菜单 其实我觉得 asp二级联动菜单 与 php二级联动菜单 两个相同只是表示方式不一样. ...

  9. C#:二级联动菜单的实现

    二级联动菜单,顾名思义,即一个菜单的变化会自动触发另一个相关联菜单的变化. 举个简单的例子,第一个菜单显示"北京",第二菜单会相应绑定列表"海淀区"," ...

最新文章

  1. 庆祝自己过了ACP!!
  2. Shell脚本中的交互式命令处理
  3. Discuz!NT发帖回复后没有积分动画的去除和修复方法
  4. hadoop yarn 获取日志_在 YARN 中简化用户日志的管理和使用
  5. 网关过滤器验证token
  6. docker安装mysql数据库映射_Docker安装mysql数据库
  7. 老机型能更新鸿蒙,华为和荣耀老机型用户有福:确定能批量升级到鸿蒙系统!...
  8. linux镜像文件的rpm,REDHAT安装镜像里的RPM文件02
  9. 纯命令行linux环境,Ubuntu Server纯命令行环境安装 Dropbox
  10. 吸顶灯怎么固定天花板_吸顶灯怎么安装?家庭圆形吸顶灯底座安装步骤(图文解说)...
  11. 济南学习 Day 5 T1 晚
  12. 诸神战纪堕落天使java_诸神战纪-堕落天使路西法
  13. CTF中压缩文件的常见解法
  14. 《网络安全应急响应技术实战指南》知识点总结(第10章 流量劫持网络安全应急响应)
  15. k线图示列--基于HIGHSTOCK
  16. oracle怎么对账,Oracle EBS 如何月结、对账[Z]
  17. 爬取猫眼电影top100
  18. E - DNA Sequence POJ - 2778
  19. Windows 7 与 Linux 的双系统安装
  20. SpringBoot OA自动化办公系统

热门文章

  1. 我就是那个一直拿着死工资的人
  2. .Net水晶报表的使用总结
  3. 使用Hyper-V Server创建Linux虚拟机
  4. 自动完成下拉框 Select2 关键字搜索的实例(本地数据与异步获取)
  5. asp.net获取当前页面的url地址
  6. hibernate _批量抓取
  7. 基于【CentOS-7+ Ambari 2.7.0 + HDP 3.0】搭建HAWQ数据仓库02 ——使用ambari-server安装HDP...
  8. OpenStack快速入门-queens版本
  9. 10月25日学习内容整理:数据操作:增加更新删除,单表查询操作
  10. 如何实现一个楼中楼的评论系统