getarea.js
来自「仿招聘网站 SSH框架 ajax功能」· JavaScript 代码 · 共 69 行
JS
69 行
var xmlHttp;
function createXMLHttpRequest(){
if(window.XMLHttpRequest){ // Mozilla 浏览器
xmlHttp = new XMLHttpRequest();
}else if (window.ActiveXObject){ // IE 浏览器
try{
xmlHttp = new ActiveXObject("Msxml2.XMLHTTP");
}catch(e){
try{
xmlHttp = new ActiveXObject("Microsoft.XMLHTTP");
}catch(e){}
}
}
}
function showBigArea(){
var cityid=document.getElementById("userinfo.bideCity").value;
createXMLHttpRequest();
xmlHttp.onreadystatechange=bidArea;
xmlHttp.open("Get","doperson.do?o=getAreaByCity&cityid="+cityid);
xmlHttp.send(null);
}
function showRegArea()
{
var cityid=document.getElementById("userinfo.regCity").value;
createXMLHttpRequest();
xmlHttp.onreadystatechange=regarea;
xmlHttp.open("Get","doperson.do?o=getAreaByCity&cityid="+cityid);
xmlHttp.send(null);
}
function bidArea(){
if(xmlHttp.readyState==4){
if(xmlHttp.status==200){
var result=xmlHttp.responseXML.getElementsByTagName("gradeSort");
while(document.getElementById("userinfo.bidArea").options.length>0){
document.getElementById("userinfo.bidArea").removeChild(document.getElementById("userinfo.bidArea").childNodes[0]);
}
for(var i=0;i<result.length;i++){
var option=document.createElement("OPTION");
option.text=result[i].childNodes[0].childNodes[0].nodeValue;
option.value=result[i].childNodes[1].childNodes[0].nodeValue;
document.getElementById("userinfo.bidArea").options.add(option);
}
}
}
}
function regarea(){
if(xmlHttp.readyState==4){
if(xmlHttp.status==200){
var result=xmlHttp.responseXML.getElementsByTagName("gradeSort");
while(document.getElementById("userinfo.regArea").options.length>0){
document.getElementById("userinfo.regArea").removeChild(document.getElementById("userinfo.regArea").childNodes[0]);
}
for(var i=0;i<result.length;i++){
var option=document.createElement("OPTION");
option.text=result[i].childNodes[0].childNodes[0].nodeValue;
option.value=result[i].childNodes[1].childNodes[0].nodeValue;
document.getElementById("userinfo.regArea").options.add(option);
}
}
}
}
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?