时间:2021-07-01 10:21:17 帮助过:3人阅读
本文主要介绍使用 Jquery+Ajax+xml,首先需要一个包含我国所有地图信息的xml文档。
此处选用的xml文档(共1000多行)主要结构如下:
<?xml version="1.0" encoding="utf-8"?> <area Country="China"> <province ID="1" provinceID="110000" province="北京市"> <City CityID="110100" City="市辖区"> <Piecearea PieceareaID="110101" Piecearea="东城区" /> <Piecearea PieceareaID="110102" Piecearea="西城区" /> <Piecearea PieceareaID="110103" Piecearea="崇文区" /> <Piecearea PieceareaID="110104" Piecearea="宣武区" /> <Piecearea PieceareaID="110105" Piecearea="朝阳区" /> <Piecearea PieceareaID="110106" Piecearea="丰台区" /> <Piecearea PieceareaID="110107" Piecearea="石景山区" /> <Piecearea PieceareaID="110108" Piecearea="海淀区" /> <Piecearea PieceareaID="110109" Piecearea="门头沟区" /> <Piecearea PieceareaID="110111" Piecearea="房山区" /> <Piecearea PieceareaID="110112" Piecearea="通州区" /> <Piecearea PieceareaID="110113" Piecearea="顺义区" /> <Piecearea PieceareaID="110114" Piecearea="昌平区" /> <Piecearea PieceareaID="110115" Piecearea="大兴区" /> <Piecearea PieceareaID="110116" Piecearea="怀柔区" /> <Piecearea PieceareaID="110117" Piecearea="平谷区" /> </City> <province>
制作对应的表单,根据设置选择省/市的动作:
<h2>地区三级联动菜单</h2> 省:<select id="province" onchange="showcity()"><option value="0">-请选择-</option></select> 市:<select id="city" onchange="showdistrict()"><option value="0">-请选择-</option></select> 地区:<select id="district"><option value="0">-请选择-</option></select>
以下是JS代码行
以上就是用Jquery+Ajax+xml制作三级联动效果的详细内容,更多请关注Gxl网其它相关文章!