两种方式实现Ajax省市三级联动菜单
源数据库来自信息产业部网站,为xls格式(excel),作者自己存储为access和xml格式1.XML方式
程序代码:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www. xmlns="http://www. xml:lang="zh-cn" lang="zh-cn"> <head> <meta http-equiv="Content-Type" content="text/html; charset=gb2312" /> <title>xml测试--省市三级联动菜单</title> <script language="javascript" src="jquery.js"></script> <script language="javascript" src="district.js"></script> </head> <body> <div style="display:inline;" id="prv"></div> <div style="display:inline;" id="shi"></div> <div style="display:inline;" id="xian"></div> </body> </html>
2.Access数据库方式
程序代码:
<html> <HEAD> <title>AJAX县市</title> <meta http-equiv="Content-Type" content="text/html; charset=gb2312"> <script language="javascript" src="fun.js"></script> </HEAD> <BODY onload="Star('000000','sheng');"> <form name="addart" id="f1" method="get" action=""> <SELECT name="sheng" ID="sheng" onclick="Star(this.options[this.selectedIndex].value,'shi');"> <option>选择省 </select> <select name="shi" id="shi" onclick="Star(this.options[this.selectedIndex].value,'xian');"> <option>选择市 </select> <select name="xian" id="xian"> <option>选择县 </select> </form> </body> </html>
也可以到这里来下载源代码:
http://www.