Client Code :
Copy code The Code is as follows: <! Doctype HTML public "-// W3C // dtd xhtml 1.0 transitional // en" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<HTML xmlns = "http://www.w3.org/1999/xhtml">
<Head>
<Meta http-equiv = "Content-Type" content = "text/html; charset = gb2312"/>
<Title> untitled document </title>
</Head>
<SCRIPT type = "text/JavaScript">
VaR XMLHTTP;
VaR A = new array ();
Function createxmlhttprequest (){
If (window. activexobject ){
XMLHTTP = new activexobject ("Microsoft. XMLHTTP ");
}
Else if (window. XMLHttpRequest ){
XMLHTTP = new XMLHttpRequest ();
}
}
Function send_request (){
Createxmlhttprequest ();
VaR year = Document. getelementbyid ("year ");
VaR url = "check_2.php? Page = "+ escape (Year. value );
XMLHTTP. Open ("get", URL, true );
XMLHTTP. onreadystatechange = checkit;
XMLHTTP. Send (null );
}
Function checkit (){
If (XMLHTTP. readystate = 4 ){
If (XMLHTTP. Status = 200 ){
Showchild ();
}
}
}
Function showchild (){
VaR xmldoc = XMLHTTP. responsexml;
VaR content = xmldoc. getelementsbytagname ("city ");
For (VAR I = 0; I <content. length; I ++ ){
Var y = content [I];
A [I] = Y. childnodes [0]. Data;
}
Show1 ();
}
Function show1 (){
VaR OBJ = Document. getelementbyid ("name ");
VaR number = obj. length;
For (var j = obj. Length-1; j> = 0; j --){
OBJ. removechild (obj. childnodes. Item (j ));
}
For (VAR I = 0; I <A. length; I ++ ){
VaR opt = Document. createelement ("option ");
Opt. Text = A [I];
OBJ. Add (OPT );
}
}
</SCRIPT>
<Body>
Year: <select id = "year" onchange = "send_request ()">
<Option value = "0"> select </option>
<Option value = "1"> 1996-2006 </option>
<Option value = "2"> 1986-1995 </option>
<Option value = "3"> 1971-1985 </option>
<Option value = "4"> 1970 or earlier </option>
</SELECT>
Subdirectory: <select id = "name">
<Option value = "0"> select </option>
</SELECT>
</Body>
</Html>
server code: copy Code the code is as follows: header ('content-type: text/xml');
$ xml = " ";
$ year = $ _ Get [" page "];
$ content = $ XML. " ";
if ($ year = "1") {
$ content = $ content. " 1 11 ";
}< br> else if ($ year = '2') {
$ content = $ content. " 2 12 ";
}< br> else if ($ year = '3') {
$ content = $ content. " 3 13 ";
}< br> else if ($ year = '4') {
$ content = $ Content. " 4 14 ";
}< br> echo $ content;
?>