首页>>表单>>全国城市三级联动(2014-09-04)

全国城市三级联动

 不是数据库的,从js文件读取

如果要找数据库的,本站有好几个了,这里推荐一个《ajax php mysql无限级联菜单 联动菜单 二级联动 三级联动菜单》

全国城市三级联动
赞赏支持
立刻微信赞赏支持 关闭

 XML/HTML Code

  1. <select id="s_province" name="s_province"></select>    
  2.     <select id="s_city" name="s_city" ></select>    
  3.     <select id="s_county" name="s_county"></select>  
  4.     <script class="resources library" src="area.js" type="text/javascript"></script>  
  5.       
  6.     <script type="text/javascript">_init_area();</script>  

 

 

JavaScript Code
  1. <script type="text/javascript">  
  2. var Gid  = document.getElementById ;  
  3. var showArea = function(){  
  4.     Gid('show').innerHTML = "<h3>省" + Gid('s_province').value + " - 市" +      
  5.     Gid('s_city').value + " - 县/区" +   
  6.     Gid('s_county').value + "</h3>"  
  7.                             }  
  8. Gid('s_county').setAttribute('onchange','showArea()');  
  9. </script>  

 


原文地址:http://www.freejs.net/article_biaodan_429.html