中文字幕日韩一区二区_国产一区二区av_国产毛片av_久久久久国产一区_色婷婷电影_国产一区二区精品

基于asp+ajax和數(shù)據(jù)庫(kù)驅(qū)動(dòng)的二級(jí)聯(lián)動(dòng)菜單

index.ASP 頁(yè)面代碼
復(fù)制代碼 代碼如下:
<!--#include file="conn.ASP" -->
<%
set cmd = conn.execute("select bigclassid,bigclassname from bigclass")
tempid=cmd("bigclassid")
%>
<select name="menu" onChange="getsubcategory(this.value);">

<%
if not cmd.eof then
do while not cmd.eof
bigclassid= cmd("bigclassid")
bigclassname = cmd("bigclassname")
%>
<option value="<%=bigclassid%>"><%=bigclassname%></option>
<%
cmd.movenext
loop
end if
cmd.close
set cmd = nothing
%>
</select>
<div id="subclass">
<select name="submenu">

<%
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")%>
<option value="<%=smallclassid%>"><%=smallclassname%></option>
<%
cxd.movenext
loop
cxd.close
set cxd = nothing
else
html = "<select name='smallclassid'><option value='0' selected>暫無(wú)小類</option></select>"
response.write html
end if
%>
</select>
</div>

ajax.js 代碼
復(fù)制代碼 代碼如下:
// 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="<select name='smallclassid'><option value='0' selected>選擇二級(jí)分類</option></select>";
return;
};
var xmlhttpobj = createxmlhttp();
if(xmlhttpobj){//如果創(chuàng)建對(duì)象xmlhttpobj成功
xmlhttpobj.onreadystatechange=handle;
xmlhttpobj.open('get',"getsubcategory.ASP?bigclassid="+bigclassid+"&number="+Math.random(),true);//get方法 加個(gè)隨機(jī)數(shù)。


xmlhttpobj.send(null);
}
}

function handle(){//客戶端監(jiān)控函數(shù)
//if(xmlhttpobj.readystate==4){//服務(wù)器處理請(qǐng)求完成
if(xmlhttpobj.status==200){
//alert('ok');
var html = xmlhttpobj.responseText;//獲得返回值
document.getElementById("subclass").innerHTML=html;
}else{
document.getElementById("subclass").innerHTML="對(duì)不起,您請(qǐng)求的頁(yè)面有問(wèn)題...";
}
//}
//else{
//document.getElementById("subclass").innerHTML=xmlhttpobj.readystate;//服務(wù)器處理中
//}
//}

}

getsubcategory.ASP 代碼
復(fù)制代碼 代碼如下:
<%@language="vbscript" codepage="936"%>
<!--#include file="conn.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 "非法參數(shù)"
response.end
end if%>

<%on error resume next
set p = conn.execute("select * from smallclass where bigclassid=" & bigclassid)
if err then
err.clear
response.write "查詢出錯(cuò)"
response.end
end if
if not p.eof then
html = "<select name='select2'>"&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 name='smallclassid'><option value='0' selected>暫無(wú)小類</option></select>"
end if
p.close
set p = nothing
conn.close
set conn = nothing
response.write html
html = ""
end if
%>

php技術(shù)基于asp+ajax和數(shù)據(jù)庫(kù)驅(qū)動(dòng)的二級(jí)聯(lián)動(dòng)菜單,轉(zhuǎn)載需保留來(lái)源!

鄭重聲明:本文版權(quán)歸原作者所有,轉(zhuǎn)載文章僅為傳播更多信息之目的,如作者信息標(biāo)記有誤,請(qǐng)第一時(shí)間聯(lián)系我們修改或刪除,多謝。

主站蜘蛛池模板: 日韩免费视频一区二区 | 精品一区二区免费视频 | 色婷婷综合在线观看 | 国产成人精品一区二区三区网站观看 | 精品国产乱码久久久久久牛牛 | 中文字幕av网 | 久久久久国产一区二区三区四区 | 天堂色网 | 亚洲精品自拍 | 高清一区二区视频 | 亚洲久视频 | 免费观看www7722午夜电影 | 国产成人免费一区二区60岁 | 日韩在线欧美 | 日本久久久久久 | 欧美一级黑人aaaaaaa做受 | 午夜免费在线 | 亚洲欧美中文日韩在线v日本 | 一二三四在线视频观看社区 | 久久久久久久久毛片 | 亚洲国产一区二区三区在线观看 | 成人二区 | 日本三级日产三级国产三级 | 精品欧美一区二区在线观看视频 | 美日韩免费| 精品久久久久香蕉网 | 午夜国产 | 日韩欧美在线不卡 | 日p视频免费看 | 日本一区二区三区四区 | 国产一区二区电影网 | 亚洲日本激情 | 久久国产综合 | 黄色一级视频 | 色屁屁在线观看 | 99久久精品免费看国产四区 | 性高湖久久久久久久久aaaaa | 国产精品日本一区二区不卡视频 | 91精品国产综合久久婷婷香蕉 | 网站国产 | 日p视频免费看 |