DZone Snippets is a public source code repository. Easily build up your personal collection of code snippets, categorize them with tags / keywords, and share them with the world

Snippets has posted 5883 posts at DZone. View Full User Profile

Yahoo Geocoder JMaki Widget For Phobos

02.07.2007
| 1580 views |
  • submit to reddit
        Yahoo geocoder jMaki widget for Phobos

<% library.jmaki.insert(
    {
        component : "yahoo.geocoder",
        service : "xhp"
    }
    ); %> 

<script  type:"text/javascript">
    function geoCoderListener(coordinates) {
    var targetDiv = document.getElementById("geocoder001_message");
    var reponseText  = "";
    for (var i in coordinates) {
        reponseText += "Latitude=" + coordinates[i].latitude + " Longitude=" +  coordinates[i].longitude + "<br>";
    }
    targetDiv.innerHTML = reponseText;
    }
    // subscribe to the topic '/yahoo/geocode' to which this widget publishes events
    jmaki.subscribe("/yahoo/geocoder", geoCoderListener);
</script>
<div id="geocoder001_message"></div>