JavaScript 省市县三级联动
2010-03-16
效果演示
HTML 前端调用代码:
01 | < fieldset style = "padding:5px;" > |
02 | < legend >省市联动</ legend > |
03 | 出生地:< select name = "P1" ></ select >< select name = "C1" ></ select >< br > |
04 | 所在地:< select name = "P2" ></ select >< select name = "C2" ></ select >< br > |
05 | 工作地:< select name = "P3" ></ select >< select name = "C3" ></ select >< br > |
06 | </ fieldset > |
07 |
08 | < br > |
09 |
10 | < fieldset style = "padding:5px;" > |
11 | < legend >省市地区联动</ legend > |
12 | 出 生 地:< select name = "province" ></ select >< select name = "city" ></ select >< select name = "area" ></ select >< br > |
13 | 户 口 所 在 地:< select name = "province1" ></ select >< select name = "city1" ></ select >< select name = "area1" ></ select >< br > |
14 | 工 作 所 在 地:< select name = "province2" ></ select >< select name = "city2" ></ select >< select name = "area2" ></ select >< br > |
15 | < br > |
16 | 无 默 认:< select name = "province3" ></ select >< select name = "city3" ></ select >< select name = "area3" ></ select >< br > |
17 | 默 认 省:< select name = "province4" ></ select >< select name = "city4" ></ select >< select name = "area4" ></ select >< br > |
18 | 默 认 省 市:< select name = "province5" ></ select >< select name = "city5" ></ select >< select name = "area5" ></ select >< br > |
19 | 默 认 省 市 区:< select name = "province6" ></ select >< select name = "city6" ></ select >< select name = "area6" ></ select >< br > |
20 | </ fieldset > |
21 | < script language = "javascript" defer> |
22 | new PCAS("P1","C1"); |
23 | new PCAS("P2","C2","吉林省"); |
24 | new PCAS("P3","C3","江苏省","苏州市"); |
25 |
26 | new PCAS("province","city","area","吉林省","白城市","大安市"); |
27 | new PCAS("province1","city1","area1","吉林省","吉林市","龙潭区"); |
28 | new PCAS("province2","city2","area2","江苏省","苏州市","沧浪区"); |
29 |
30 | new PCAS("province3","city3","area3"); |
31 | new PCAS("province4","city4","area4","江苏省"); |
32 | new PCAS("province5","city5","area5","江苏省","苏州市"); |
33 | new PCAS("province6","city6","area6","江苏省","苏州市","沧浪区"); |
34 | </ script > |