August 21, 2014
Hot Topics:
RSS RSS feed Download our iPhone app

Introducing the Google Maps JavaScript API V3

  • October 1, 2010
  • By Jason Gilmore
  • Send Email »
  • More Articles »

Adding Informational Windows

Associating informational windows with a marker via an event handler is similarly easy. Using standard HTML markup you can format the window content however you please, and then pass that markup to an InfoWindow object. You'll then use the InfoWindow object's open() method to open the window when the marker's event handler fires, as demonstrated here:

var content = "<b>43201 Zip Code</b><br />The 43201 zip code is 
home to Columbus' Victorian Village and Harrison
West neighborhoods.";

var infowindow = new google.maps.InfoWindow({
content: content
});

google.maps.event.addListener(marker, 'click', function() {
infowindow.open(map,marker);
});

Replacing the previous event handler with this snippet produces the map presented in Figure 4.

 

 

Learning Resources for Google Maps API V3

This tutorial should provide you with a solid understanding of V3's basic features. However, one could spend literally weeks investigating the countless interesting features in this fantastic API. Consider checking out the following links to learn more about what's possible!

  • The Official V3 Developer's Guide: Check out the official documentation for a detailed introduction to the API, in addition to interesting demos and pointers to other articles.
  • Developing Native iPhone Applications with V3: This excellent tutorial shows you just how easy it is to develop a simple location-based application using the iPhone SDK and Google Maps API V3.
  • The Google Maps API Family: The JavaScript API is only one of several APIs at your disposal. Check out this list to learn more about the Flash API, Earth API and Static Maps API, among others.

Conclusion

The Google Maps API version 3 release represents another evolutionary step forward for the world's most popular and compelling Web mapping solution. Are you currently using the new version in a project? Tell us about your experiences in the comments!

About the Author

Jason Gilmore is founder of the publishing and consulting firm WJGilmore.com. He is the authorof several popular books "Easy PHP Websites with the Zend Framework","Easy PayPal with PHP", and"Beginning PHP and MySQL, Fourth Edition". Follow him on Twitter at @wjgilmore.


Tags: JavaScript, Google Maps, APIs



Page 2 of 2



Comment and Contribute

 


(Maximum characters: 1200). You have characters left.

 

 


Sitemap | Contact Us

Rocket Fuel