我有三个下拉列表:国家、州和城市。
我希望基于国家列表中的选择填充状态列表,并根据状态列表中的选择填充城市列表。
以下是我尝试的方法
来自国家列表的
然后,
函数onCountryChange(str){ if (window.XMLHttpRequest){ xmlhttp=new XMLHttpRequest();} xmlhttp=new {xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");} xmlhttp.onreadystatechange=function(){ if (xmlhttp.readyState==4 & xmlhttp.status==200){ xmlhttp.readyState==4&xmlhttp.status==200){GET} xmlhttp.open("GET",“.}
3在我的客户端.Used下面的代码来显示结果。
<div id="statenames">
//Original select list placed here is replaced by the one returned by server.
</div>这确实适用于我,而且各州都是根据国家名称来填充的。现在我如何填充第三个列表。我选择的显示状态列表的方法正确吗?因为我无法控制我现在得到的状态的选择列表。
发布于 2012-05-16 17:59:33
在html页面中创建3选择国家、城市和州
document.getElementById('state').innerHTML(state_ajax_response);
然后在html文件中创建函数,该函数将在状态上被调用,选择change,然后再次重复城市选择的过程。
希望你能明白。
只需发送选项元素作为响应。
https://stackoverflow.com/questions/10623547
复制相似问题