SitePoint Sponsor

User Tag List

Results 1 to 2 of 2
  1. #1
    SitePoint Guru ripcurlksm's Avatar
    Join Date
    Aug 2004
    Location
    San Clemente, CA
    Posts
    859
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Google Maps API - Javascript

    Did Google Maps change its API over the last few weeks? Everything has been working fine for the past 8 months. My website that has a series of points on a map that link to a page about that site has stopped working. The map disappeared!

    Here is a sample of the .js I am using to call the market points:


    HTML to print map
    Code JavaScript:
    <script src="http://maps.google.com/maps?file=api&amp;v=2&amp;key=ABQIAAAARp9_U94rLR5M4TbsSFipMBSShf5aY6HoGtihlXXXXXXXXXXX" type="text/javascript"></script>
     
    <div id="map" style="width: 700px; height: 400px"></div>[/CODE]

    Market Points
    Code JavaScript:
    if (GBrowserIsCompatible()) {
    function createMarker(point,html) {
    var marker = new GMarker(point);
    GEvent.addListener(marker, "click", function() {
    marker.openInfoWindowHtml(html);
    });
    return marker;
    }
     
    var map = new GMap2(document.getElementById("map"));
    map.addControl(new GLargeMapControl());
    map.addControl(new GMapTypeControl());
    map.setCenter(new GLatLng(37.4419, 0), 1);
     
    var point = new GLatLng(19.8009,-105.352);
    var marker = createMarker(point,'<div style="width:240px"><font size="3">TITLE ONE</font><p><a href="resort.php?id=2"><br>Click here to view this location</a></div>')
    map.addOverlay(marker);
     
    var point = new GLatLng(-16.2337,179.565);
    var marker = createMarker(point,'<div style="width:240px"><font size="3">TITLE TWO</font><p><a href="resort.php?id=2"><br>Click here to view this location</a></div>')
    map.addOverlay(marker);
     
    ..etc

  2. #2
    Follow Me On Twitter: @djg gold trophysilver trophybronze trophy Dan Grossman's Avatar
    Join Date
    Aug 2000
    Location
    Philadephia, PA
    Posts
    20,578
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)
    No, nothing's changed, I do points on W3Counter's visitor maps almost exactly the same and they're working fine.

    It's probably a single quote in a title or something else breaking one of your points. Whenever any point gets broken, my maps don't appear either.

    Easiest way to find out is to look for errors in the Error Console in Firefox (Tools > Error Console). Clear it then load your page with the map and check again.


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •