开发者

Help to generate an option list dropdown (jump to) from an xml file for google maps

I have an xml file, which is pulled into a google map just fine.

I would like to add a directions option to my map.

In order to do this, I need a dropdown for all markers on the map.

开发者_运维技巧

A row of my xml looks like

<marker id="12" name="placename" category="11" lat="66.555488" 
        lng="5.238545" address1="property name" address2="roadname" 
        address3="town" address4="" county="some county" postcode="ab1 1ab"/>

So in my html on the page, I need to show

<option value="53.2,5.238545">placename</option> 

or

<option value="lat,lng">name</option> 

repeated for each entry in the XML.

How can I generate such a dropdown automatically from the xml file?


Parse your XML using PHP (or another programming language). If you do it with PHP you can use the SimpleXML library.

You could also do it with Javascript. I'm not sure what Javascript library does xml.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜