<!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>
<title> new document </title>
<script src="jquery-1.2.6.js" type="text/javascript"></script>
<script type="text/javascript">
$(document).ready(function()
{
$.get('area.xml', function(d){
$('#sel_province').children().remove();
$(d).find('province').each(function(){
$('#sel_province').append("<option value='"+$(this).attr("name")+"'>"+$(this).attr("name")+"</option");
});
$('#sel_city').children().remove();
$(d).find('province:first>city').each(function(){
$("#sel_city").append("<option value='"+$(this).attr("name")+"'>"+$(this).attr("name")+"</option");
});
$('#sel_country').children().remove();
$(d).find('province:first>city:first>country').each(function(){
$("#sel_country").append("<option value='"+$(this).attr("name")+"'>"+$(this).attr("name")+"</option");
});
});
$("#sel_city").change(function(){
$.get('area.xml', function(d){
$('#sel_country').children().remove();
$(d).find("province[name="+document.getElementById("sel_province").value+"]>city[name="+document.getElementById("sel_city").value+"]>country").each(function(){
//alert($(this).attr("name"));
$("#sel_country").append("<option value='"+$(this).attr("name")+"'>"+$(this).attr("name")+"</option");
});
});
});
$("#sel_province").change(function(){
$.get('area.xml', function(d){
$('#sel_city').children().remove();
$(d).find("province[name="+document.getElementById("sel_province").value+"]>city").each(function(){
//alert($(this).attr("name"));
$("#sel_city").append("<option value='"+$(this).attr("name")+"'>"+$(this).attr("name")+"</option");
});
$('#sel_country').children().remove();
$(d).find("province[name="+document.getElementById("sel_province").value+"]>city:first>country").each(function(){
$("#sel_country").append("<option value='"+$(this).attr("name")+"'>"+$(this).attr("name")+"</option");
});
});
});
});
</script>
</head>
<body>
<form>
<select id="sel_province">
<option>请选择</option>
</select>
<select id="sel_city">
<option>请选择</option>
</select>
<select id="sel_country">
<option>请选择</option>
</select>
</body>
</html>