<p> 下面的两个文件copy到同一个文件下,通过web路径访问index.html看看吧,这个是通过iframe来实现的连动更新,list.php目前的内容比较简单,你看通过list.php来进行数据库查询,然后显示出查询的结果列表。<p> index.html</p><code><body><br /><form name="myfrm"><br /><select name="mlist" onchange="changes();"><br /><option value="0">请选择...</option><br /><option value="北京">北京</option><br /><option value="通化">通化</option><br /></select> <br /><select name="slist"><br /></select><br /><iframe id="frame" src="list.php?city=" style="display:none;"></iframe><br /><script language="javascript"><br />function changes(){<br />frame.location.href = "list.php?city=" + document.myfrm.mlist.value;<br />}<br /></script><br /></form><br /></body></code></p><p> list.php</p><code><?php<br />$data = array("北京"=>array("小强","旺财","小强他爹"),<br /> "通化"=>array("小温","小宋","他们儿子"),);<br />$city = $_GET["city"];<br />$result = $data[$city];<br />$str = "<script language="javascript">list = parent.document.myfrm.slist;list.length = 0;";<br />if($result==null)<br /> $str .= "tmp = new Option("......", "");list.options[0] = tmp;";<br />else<br /> foreach($result as $i => $value)<br /> $str .= "tmp = new Option("{$value}", "{$value}");list.options[$i] = tmp;";<br />$str .= "</script>";<br /> <br /> echo $str;<br />?></code></p><p> 来源:<a href="http://blog.csdn.net/hahawen">http://blog.csdn.net/hahawen</a></p>