asp+ajaxとデータベースドライバーによる二次連携メニュー_PHPチュートリアル

WBOY
リリース: 2016-07-21 15:39:13
オリジナル
884 人が閲覧しました

Index.asp 页面代码

复制代代码如下:


<%
set cmd = conn.execute("select bigclassid,bigclassname from bigclass")
tempid=cmd("bigclassid")
%>


ajax.js 代码
复制代码代码如下:

// JavaScript Document
function createxmlhttp()
{
xmlhttpobj = false;
try{
xmlhttpobj = 新しい XMLHttpRequest;
}catch(e){
try{
xmlhttpobj=new ActiveXObject("MSXML2.XMLHTTP");
}catch(e2){
try{
xmlhttpobj=new ActiveXObject("Microsoft.XMLHTTP");
}catch(e3){
xmlhttpobj = false;
}
}
}
xmlhttpobj を返します。
}

function getsubcategory(bigclassid){
if(bigclassid==0){
document.getElementById("subclass").innerHTML=" ";
戻る;
};
var xmlhttpobj = createxmlhttp();
if(xmlhttpobj){//如果创建对オブジェクトxmlhttpobj成功
xmlhttpobj.onreadystatechange=handle;
xmlhttpobj.open('get',"gestbcategory.asp?bigclassid="+bigclassid+"&number="+Math.random(),true);//get メソッド加个随机数。


xmlhttpobj.send(null );
}
}

function handle(){//客户端监制御関数
//if(xmlhttpobj.readystate==4){// 服务器处理请要求完了
if(xmlhttpobj.status==200){
//アラート('ok');
var html = xmlhttpobj.responseText;//获得返值
document.getElementById("subclass").innerHTML=html;
}else{
document.getElementById("subclass").innerHTML="对不起,您请求的页面有问题...";
}
//}
//else{
//document.getElementById("subclass").innerHTML=xmlhttpobj.readystate;//服务器处理中
//}
//}

}

月別カテゴリ。 asp 代
复制代代码如下:

<%@ language="vbscript" codepage="936"%>

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

<%on エラーで次の再開
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 = " "
else
html = " "
end if
p.close
set p = nothing
conn.close
set conn = nothing
response.write html
html = ""
end if
%>

www.bkjia.com true http://www.bkjia.com/PHPjc/321638.html 技術記事 Index.asp ページ コードのコピー コードは次のとおりです: !--#include file="conn.asp" -- % set cmd = conn.execute("select bigclassid,bigclassname from bigclass") tempid=cmd("bigclassid") % ...
ソース:php.cn
このウェブサイトの声明
この記事の内容はネチズンが自主的に寄稿したものであり、著作権は原著者に帰属します。このサイトは、それに相当する法的責任を負いません。盗作または侵害の疑いのあるコンテンツを見つけた場合は、admin@php.cn までご連絡ください。
最新の問題
人気のおすすめ
人気のチュートリアル
詳細>
最新のダウンロード
詳細>
ウェブエフェクト
公式サイト
サイト素材
フロントエンドテンプレート
私たちについて 免責事項 Sitemap
PHP中国語ウェブサイト:福祉オンライン PHP トレーニング,PHP 学習者の迅速な成長を支援します!