JavaScript parsing XML Implementation of the three-level linkage method _javascript skills in provinces and counties

Source: Internet
Author: User
Tags xml parser

This article illustrates the method of JavaScript parsing XML to realize three-level linkage in provinces and counties. Share to everyone for your reference. The implementation methods are as follows:

(This method applies to any common browser)

<body> <div> <span> <select id= "sheng" style= "width:100px" ></select> </span&gt
  ; <span> <select id= "shi" style= "width:100px" ></select> </span> <span> <select I D= "Xian" style= "width:100px" ></select> </span> </div> </body>  

XML file (abbreviated version)

<root name= "China" > <province name= "Please select Province" postcode= "100000" > <city name= "Please select City" postcode= "100100" > &L T;area name= "Please select the area" postcode= "100101"/> </city> </province> <province name= "Beijing" postcode= "110000" &G
  T <city Name= "The Municipal District" postcode= "110100" > <area name= "Dongcheng District" postcode= "110101"/> <area name= "Xicheng" postcod E= "110102"/> <area name= "Chongwen District" postcode= "110103"/> "<area name=" Xuan Wu "postcode=" 110104 "/> <a Rea name= "Chaoyang District" postcode= "110105"/> <area name= "Fengtai District" postcode= "110106"/> <area name= "Shijingshan" postcode= " 110107 "/> <area name=" Haidian "postcode=" 110108 "/> <area name=" Mentougou District "postcode=" 110109 "/> <are A name= "Fangshan District" postcode= "110111"/> <area name= "Tongzhou District" postcode= "110112"/> <area name= "Shunyi District" postcode= "110 113 "/> <area name=" Changping District "postcode=" 110114 "/> <area name=" Daxing District "postcode=" 110115 "/> <area na Me= "Huairou" postcode= "110116 "/> <area name=" Pinggu District "postcode=" 110117 "/> </city> <city name=" county "postcode=" 110200 "> <area name= "Miyun County" postcode= "110228"/> <area name= "Yanqing County" postcode= "110229"/> </city> </provin Ce> </root>

The

wants this article to help you with your JavaScript programming.

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.