日期:2014-05-16  浏览次数:20418 次

js解析XML文件实现省市区三级联动兼容fireFox

city.xml 文件

<?xml version="1.0" encoding="UTF-8"?>
<root name="中国">
?<province name="请选择省" postcode="100000" >
??? <city name="请选择市" postcode="100100" >
?? <area name="请选择区" postcode="100101" />
?</city>
? </province>
? <province name="北京市" postcode="110000" >
??? <city name="市辖区" postcode="110100" >
??????? <area name="东城区" postcode="110101" />
??????? <area name="西城区" postcode="110102" />
??????? <area name="崇文区" postcode="110103" />
??????? <area name="宣武区" postcode="110104" />
??????? <area name="朝阳区" postcode="110105" />
??????? <area name="丰台区" postcode="110106" />
??????? <area name="石景山区" postcode="110107" />
??????? <area name="海淀区" postcode="110108" />
??????? <area name="门头沟区" postcode="110109" />
??????? <area name="房山区" postcode="110111" />
??????? <area name="通州区" postcode="110112" />
??????? <area name="顺义区" postcode="110113" />
??????? <area name="昌平区" postcode="110114" />
??????? <area name="大兴区" postcode="110115" />
??????? <area name="怀柔区" postcode="110116" />
??????? <area name="平谷区" postcode="110117" />
??? </city>
??? <city name="县" postcode="110200" >
??????? <area name="密云县" postcode="110228" />
??????? <area name="延庆县" postcode="110229" />
??? </city>
? </province>
? <province name="天津市" postcode="120000" >
??? <city name="市辖区" postcode="120100" >
??????? <area name="和平区" postcode="120101" />
??????? <area name="河东区" postcode="120102" />
??????? <area name="河西区" postcode="120103" />
??????? <area name="南开区" postcode="120104" />
??????? <area name="河北区" postcode="120105" />
??????? <area name="红桥区" postcode="120106" />
??????? <area name="塘沽区" postcode="120107" />
??????? <area name="汉沽区" postcode="120108" />
??????? <area name="大港区" postcode="120109" />
??????? <area name="东丽区" postcode="120110" />
??????? <area name="西青区" postcode="120111" />
??????? <area name="津南区" postcode="120112" />
??????? <area name="北辰区" postcode="120113" />
??????? <area name="武清区" postcode="120114" />
??????? <area name="宝坻区" postcode="120115" />
??? </city>
??? <city name="县" postcode="120200" >
??????? <area name="宁河县" postcode="120221" />
??????? <area name="静海县" postcode="120223" />
??????? <area name="蓟县" postcode="120225" />
??? </city>
? </province>

? <province name="河北省" postcode="130000" >
??? <city name="石家庄市" postcode="130100" >
??????? <area name="长安区" postcode="130102" />
??????? <area name="桥东区" postcode="130103" />
??????? <area name="桥西区" postcode="130104" />
??????? <area name="新华区" postcode="130105" />
??????? <area name="井陉矿区" postcode="130107" />
??????? <area name="裕华区" postcode="130108" />
??????? <area name="井陉县" postcode="130121" />
??????? <area name="正定县" postcode="130123" />
??????? <area name="栾城县" postcode="130124" />
??????? <area name="行唐县" postcode="130125" />
??????? <area name="灵寿县" postcode="130126" />
??????? <area name="高邑县" postcode="130127" />
??????? <area name="深泽县" postcode="130128" />
??????? <area name="赞皇县" postcode="130129" />
??????? <area name="无极县" postcode="130130" />
??????? <area name="平山县" postcode="130131" />
??????? <area name="元氏县" postcode="130132" />
??????? <area name="赵县" postcode="130133" />
??????? <area name="辛集市" postcode="130181" />
??????? <area name="藁城市" postcode="130182" />
??????? <area