Hi There,

I'm trying to trigger the info window on my google map from a link
outside the map itself. It's not working and not throwing an error
either.

Can someone give me a hand with the code please?

Sean - thanks in advance



var map;

var icon0;
var newpoints = new Array();


function loadMap() {
        map = new GMap2(document.getElementById("map"));
        map.addControl(new GLargeMapControl());
        map.addControl(new GMapTypeControl());
          map.setCenter(new GLatLng(-23.700358,133.880889), 4);
        map.setMapType(G_MAP_TYPE);


    icon0 = new GIcon(G_DEFAULT_ICON);
    icon0.image = "http://myurl/images/image.png";;
    icon0.iconSize = new GSize(56, 58);
    icon0.shadowSize = new GSize(58, 60);
    icon0.iconAnchor = new GPoint(27, 34);
    icon0.infoWindowAnchor = new GPoint(9, 2);


        newpoints[0] = new Array(-33.911483 ,151.261784, icon0, '1',
'content');


        for(var i = 0; i < newpoints.length; i++) {
                var point = new GPoint(newpoints[i][1],newpoints[i][0]);
                var popuphtml = newpoints[i][4] ;
                var marker = createMarker(point,newpoints[i][2],popuphtml);
                map.addOverlay(marker);
        }
}

 function myclick(i) {
        GEvent.trigger(marker[i], "click");
      }

function createMarker(point, icon, popuphtml) {
        var popuphtml = "<div id=\"popup\">" + popuphtml + "<\/div>";
        markerOptions = { icon:icon0 };
        var marker = new GMarker(point, markerOptions);

        GEvent.addListener(marker, "click", function() {
                marker.openInfoWindowHtml(popuphtml);
        });
        return marker;

}


<a href="javascript:myclick(1)">click here</a>

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Google Maps API" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/Google-Maps-API?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to