EasyUI_前台js_省市县三级联动

1、html:

1  <td class="tdl">所属城市</td>
2     <td class="td_detail">
3     <input id="sheng" />
4     &nbsp<input id="city" />
5     &nbsp<input id="xian" />
6  </td>

2、js

 1   $("#sheng").combobox({
 2             url: '../Ajax/Customer.ashx?action=getCityByCode&code=0',
 3             valueField: 'codeID',
 4             textField: 'name',
 5             onLoadSuccess: function () {
 6             $('#sheng').combobox('select', '---请选择---');
 7             },
 8             onChange: function () {
 9                 var sheng = $("#sheng").combobox("getValue");
10                 var tag = 1;
11                 $("#city").combobox({
12                     url: "../Ajax/Customer.ashx?action=getCityByCode&code=" + sheng,
13                     valueField: 'codeID',
14                     textField: 'name',
15                     onLoadSuccess: function () {
16                     $('#city').combobox('select', '---请选择---');
17                     },
18                     onChange: function () {
19                         var city = $("#city").combobox("getValue");
20                         $("#xian").combobox({
21                             url: "../Ajax/Customer.ashx?action=getCityByCode&code=" + city,
22                             valueField: 'codeID',
23                             textField: 'name',
24                             onLoadSuccess: function () {
25                             $('#xian').combobox('select', '---请选择---');
26                             }
27                         })
28                     }
29                 })
30             }
31         })

 

posted @ 2017-04-24 09:04  Bonnie_W  阅读(268)  评论(0编辑  收藏  举报