<body onLoad="sheng()">
<div class="xqbody">
<form action="#" method="post" class="editform">
<p class="qychoose">工作区域选择:</p>
<div class="namebox">
<label>姓 名:</label>
<select name="sheng" id='sheng'>
<option>请选择省份</option>
</select>
<select name="shi" id='shi'><option>请选择城市</option></select>
<select name="qu" id='qu'><option>请选择区域</option></select>
</div>
</form>
</div>
<div class="clear"></div>
<script>
function sheng(){
$.getJSON('/php/city.php','tid=0',function(data){
var count = data.length;
var html = '';
if(count==0){return;}
for(var i=0;i<count;i++){
html = html+'<option value="'+data[i].name+'" tid="'+data[i].cid+'">'+data[i].name+'</option>';
}
$('#sheng').append(html);
});
}
$('#sheng option').live('click',function(){
var tid = $(this).attr('tid');
$.getJSON('/php/city.php','tid='+tid,function(data){
var count = data.length;
var html = '';
if(count==0){return;}
for(var i=0;i<count;i++){
html = html+'<option value="'+data[i].name+'" tid="'+data[i].cid+'">'+data[i].name+'</option>';
}
$('#shi').append(html);
});
});
$('#shi option').live('click',function(){
var tid = $(this).attr('tid');
$.getJSON('/php/city.php','tid='+tid,function(data){
var count = data.length;
var html = '';
if(count==0){return;}
for(var i=0;i<count;i++){
html = html+'<option value="'+data[i].name+'" tid="'+data[i].cid+'">'+data[i].name+'</option>';
}
$('#qu').append(html);
});
});
</script>