?? provcity.js
字號:
function Roly_ProvCity() {
this.obj = this;
this.province = "";
this.city = "";
this.list = [];
}
function Roly_ProvCity_Province() {
this.name = "";
this.cityList = [];
}
Roly.ProvCity.prototype.parseXml = function() {
var xml = document.all.ProvinceCity;
if(xml == null || xml == undefined) {
alert("Error:Can't find xml data!");
return;
}
var root = xml.documentElement;
var def = root.firstChild;
this.province = def.getAttribute("province");
this.city = def.getAttribute("city");
for(var i=1;i<root.childNodes.length;i++) {
var pNode = root.childNodes[i];
var bean = new Roly.ProvCity.Province();
bean.name = pNode.getAttribute("name");
for(var j=0;j<pNode.childNodes.length;j++) {
var cNode = pNode.childNodes[j];
bean.cityList[bean.cityList.length] = cNode.getAttribute("name");
}
this.list[this.list.length] = bean;
}
}
Roly.ProvCity.prototype.init = function(p,c) {
this.parseXml();
if(p=="null" || c=="null") {
p = "";
c = "";
}
this.province = p;
this.city = c;
var slt_usr = $("province");
var slt_dpt = $("city");
if(slt_usr == null || slt_dpt == null)
return;
slt_usr.length = 0;
slt_usr.param = this;
slt_usr.onchange = this.changeProxy;
var blank = document.createElement("option");
blank.setAttribute("value","");
blank.appendChild(document.createTextNode("------"));
slt_usr.appendChild(blank);
slt_dpt.length = 0;
for(var i=0;i<this.list.length;i++) {
var bean = this.list[i];
var op = document.createElement("option");
op.setAttribute("value",bean.name);
op.appendChild(document.createTextNode(bean.name));
if(this.province == bean.name)
op.selected = true;
slt_usr.appendChild(op);
}
if(this.province != "") {
this.change(this.province,this.city);
} else {
this.change(slt_usr.options[0].value,this.city);
}
}
Roly.ProvCity.prototype.changeProxy = function() {
var S = $("province");
var obj = S.param;
var prov_name = S.options[S.selectedIndex].value;
obj.change(prov_name);
}
//褰撻
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -