function processRequest2() {//操作函数2,调入市
if (http_request.readyState == 4) { // 判别对象形态
if (http_request.status == 200) { // 信息已胜利前往,入手下手处置信息
document.getElementById("statusTxt").innerHTML="";
addOptionGroup("city",http_request.responseText);
} else { //页面不正常
alert("您所恳求的页面有异常。");
}
}else {//只需未读取完成
document.getElementById("statusTxt").innerHTML="正则读取数据中……";
}
}
function processRequest3() {//操作函数3,输出省市
if (http_request.readyState == 4) { // 判别对象形态
if (http_request.status == 200) { // 信息已胜利前往,入手下手处置信息
document.getElementById("statusTxt").innerHTML="";
document.getElementById("district").value=http_request.responseText;
} else { //页面不正常
alert("您所恳求的页面有异常。");
}
}else {//只需未读取完成
document.getElementById("statusTxt").innerHTML="正则读取数据中……";
}
}
function loadProvince() {//载入省
send_request("select.server.php?action=province",1);//办事端处置法式,操作函数
}
function loadCity() {//载入市
document.getElementById("district").value="";//清空文本框
send_request("select.server.php?action=city&id="+document.getElementById("province").value,2);
}
function inputDistrict() {//向文本框输出选定的省市
send_request("select.server.php?action=district&id="+document.getElementById("province").value+"&id1="+document.getElementById("city").value,3);
} addOption.js
function addOption(objSelectNow,txt,val)
{
/// 利用W3C尺度语法为SELECT添加Option
var objOption = document.createElement("OPTION");
objOption.text= txt;
objOption.value=val;
objSelectNow.options.add(objOption);
}
function addOptionGroup(selectId,optGroupString)
{
var optGroup = optGroupString.split(",");
var objSelect = document.getElementsByTagName("SELECT");
var objSelectNow = objSelect[selectId];
objSelectNow.length = 1;
/// 成组添加Options
for (i=1; i<optGroup.length; i++)
{
addOption(objSelectNow, optGroup, i);
}
}