zoukankan      html  css  js  c++  java
  • 摘自淘宝的js地区组件

    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml">
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <script type="text/javascript" src="http://a.tbcdn.cn/tbra/1.0/tbra-aio.js"></script>
    <script type="text/javascript" src="http://www.taobao.com/home/js/sys/districtselector.js"></script>
    
    <p>
    	<label>地区:</label>
    	<form method="get">
    	<select name="province" id="J_redstar_province"></select>
    	<select name="city" id="J_redstar_city"></select>
    	<select name="area" id="J_redstar_area"></select>
    	<br/>
    	<input type="submit"><span>点击提交后传递的是地区对应的code码</span>
    	<form>
    </p>
    
    <script type="text/javascript">
    (function(){
    	var Y = YAHOO.util;
    	var provSel = Y.Dom.get('J_redstar_province');
       	var citySel = Y.Dom.get('J_redstar_city');
            var distSel = Y.Dom.get('J_redstar_area');
    	var cv = TB.form.DistrictSelector.attach('J_redstar_province', 'J_redstar_city', 'J_redstar_area');
    })();
    //根据code码获取具体地区的代码
    alert(TB.form.DistrictSelector._tb_ds_data[310101][0]);
    </script>
    
    </body>
    </html>
    

    正在做的一个系统需要一个前端的地区组件,刚好发现淘宝网上有,凭着开源共享的精神,就从页面上摘下来了~

    网上也有这个组件比较老的版本,但是关于根据code获取对应地区的代码比较麻烦,所以改写了下

    ps.本代码摘自淘宝网,分享仅供学习交流使用

  • 相关阅读:
    你会做夹具吗?(一)
    DDR3布线设计要点总结
    PCB设计要点-DDR3布局布线技巧及注意事项
    走进JEDEC,解读DDR(下)
    [转]关于STM32 PB3 PB4 如何设置成普通GPIO的配置
    [转]Verilog有符号数与无符号数作运算
    [转]实用光电二极管pd的采样电路
    STM32外部8M晶振不启动
    ALTCLKCTRL核的作用
    [转]如何在Altium Designer中将PCB生成PDF?
  • 原文地址:https://www.cnblogs.com/xujanus/p/3483664.html
Copyright © 2011-2022 走看看