var http_request = false;
function send_request(method,url,content,responseType,callback){ http_request=false;
if(window.XMLHttpRequest){//Mozilla浏览器
http_request=new XMLHttpRequest();
if(http_request.overrideMimeType){
http_request.overrideMimeType("text/xml");
}
}
else{
try{
http_request=new ActiveXObject("Msxml2.XMLHTTP");
}catch(e){
try{
http_request=new ActiveXObject("Microsoft.XMLHTTP"); }catch(e){}
}
}
if(!http_request){
window.alert("不能创建XMLHttpRequest对象实例。");
return false;
}
if(responseType.toLowerCase()=="text"){
http_request.onreadystatechange=callback;
}else{
window.alert("响应类别参数错误。");
return false;
}
if(method.toLowerCase()=="get"){
http_request.open(method,url,true);
}
else if(method.toLowerCase()=="post"){
http_request.open(method,url,true);
http_request.setRequestHeader("Content-Type","application/x-www-form-urlencoded");
}else{
window.alert("http请求类别参数错误。");
return false;
}
http_request.send(content);
}//处理返回文本格式信息的函数
function processTextResponse(){
if(http_request.readyState==4){
if(http_request.status==200){
alert("Text文档响应");
}else{
alert("您所请求的页面有异常。");
}
}
}
function processXMLResponse(){
if(http_request.readyState==4){
if(http_request.status==200){
alert("XML文档响应");
}else{
alert("您所请求的页面有异常。");
}
}
}
function changFirst(va)
{
window.alert(va);
if(va!='0')
{
var Second = document.getElementById("Second");
Second.disabled=true;
var Third = document.getElementById("Third");
Third.disabled=true;
var f=document.getElementById("Third");
f.options.length=1;
var url="Handler.ashx?type=First&id="+va;
send_request("GET",url,null,"text",populateClass3);
}
}
function populateClass3(){
var f=document.getElementById("Second");
var strSecond="";
if(http_request.readyState==4){
if(http_request.status==200){
var list=http_request.responseText;
if(list.length>1){
var Second = document.getElementById("Second");
Second.disabled=false;
}
var classList=list.split("|");
f.options.length=1;
for(var i=0;i<classList.length;i++){
var tmp=classList[i].split(",");
window.alert(f);
f.add(new Option(tmp[1],tmp[0]));
//f+ = '<option value='+tmp[1]+'>'+tmp[0]+'</option>'
strSecond+= '<option value='+tmp[1]+'>'+tmp[0]+'</option>';
}
}else{
alert("您所请求的页面有异常。");
}
}
}
function changSecond(va)
{
if(va!='0')
{
var Third = document.getElementById("Third");
Third.disabled=true;
var url="Handler.ashx?type=Second&id="+va;
send_request("GET",url,null,"text",populateClass4);
}
}
function populateClass4(){
var f=document.getElementById("Third");
if(http_request.readyState==4){
if(http_request.status==200){
var list=http_request.responseText;
if(list.length>1){
var Third=document.getElementById("Third");
Third.disabled=false;
}
var classList=list.split("|");
f.options.length=1;
for(var i=0;i<classList.length;i++){
var tmp=classList[i].split(",");
f.add(new Option(tmp[1],tmp[0]));
}
}else{
alert("您所请求的页面有异常。");
}
}
}
解决方案 »
免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货