

<?xml version="1.0" encoding="utf-8" ?>
<root>
<list>
<id>1</id>
<name>上海</name>
</list>
<list>
<id?2</id>
<name>北京</name>
</list>
</root>
index.asp


<html>
<select name="add1" id="add1" onChange="smt_Select(this.value)">
<option value="" selected>请选择省</option>
<%
sql="select * from address order by id desc"
Set rs=Conn.Execute(sql)
while not rs.eof%>
<option value="<%=rs("id")%>"><%=rs("name")%></option>
<%rs.movenext
wend
rs.Close()
Set rs=Nothing
%>
</select>
<select name="add2" id="add2">
<option selected value="">请选择市</option>
</select>
</html>
js


<script type="text/javascript" src="/js/jquery-1.3.1.js"></script>
<script>
function smt_Select(obj){
$.ajax(
{
type:"post",
url:"xml.asp",
datatype:"xml",
data:"type="+ntype+"&scaid="+obj+"&sid="+Math.random(),
success:function(xml)
{
document.getElementById("add2").length=0;
$(xml).find("root > list").each(
function(i){
var id=$(this).find("id").text();
var name=$(this).find("name").text();
document.getElementById("add2").options[i]=new Option(name,id);
}
)
}
});
}
</script>