首页 > 代码库 > JavaScript省市二级联动

JavaScript省市二级联动

cities.xml 

<?xml version="1.0" encoding="GB2312"?>
<china>
	<province name="吉林省">
		<city>长春</city>
		<city>吉林市</city>
		<city>四平</city>
		<city>松原</city>
		<city>通化</city>
	</province>
	<province name="辽宁省">
		<city>沈阳</city>
		<city>大连</city>
		<city>鞍山</city>
		<city>抚顺</city>
	</province>
	<province name="山东省">
		<city>济南</city>
		<city>青岛</city>
		<city>威海</city>
		<city>烟台</city>
		<city>潍坊</city>
	</province>
	<province name="湖北省">
		<city>武汉</city>
		<city>广水</city>
		<city>孝感</city>
		<city>荆州</city>
		<city>黄石</city>
		<city>鄂州</city>
		<city>黄冈</city>
	</province>
</china>	


city.html

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
  <head>
    <title>二级联动</title>
    <meta http-equiv="content-type" content="text/html; charset=UTF-8">
  </head>
  
  <body>
    <select id="province" >
    	<option>--请选择--</option>
    	<option value=http://www.mamicode.com/"湖北省">湖北省>