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 代码
复制代码 代码如下:
<%@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 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 = ""&vbnewline do while not p.eof html = html&""&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 %>
http://www.bkjia.com/PHPjc/321638.htmlwww.bkjia.comtruehttp: //www.bkjia.com/PHPjc/321638.htmlTechArticleindex.asp Page code copy code is as follows: !--#include file="conn.asp" -- % set cmd = conn.execute("select bigclassid,bigclassname from bigclass") tempid=cmd("bigclassid") %...
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn