View Full Version : Javascript into google map

09-05-2008, 09:35 AM
Hi all,
I am trying to incorporate a personalized google map into my website. But my experience of Java is so limited that I am having some troubles understanding an answer that was given to me.
Here is the page concerned. (http://www.sacred-egypt.com/ancient_egypt/cities/menu2.html)
Here is the issue: Im trying to have html links of cities somewhere outside of the map to trigger a response on the map, so that when the html link of a city is clicked on, the info window opens for that city on the map. (same behaviour as when the points are clicked on the map)
Here is the answer that was given to me:
You need to keep references to all the markers in an array in the
global scope, and then use those references to trigger the click

(1) Create an array that is global, defined outside of the function

var myMarkers = Array();
function initialize() {
if (GBrowserIsCompatible()) {

(2) add each marker to that array and keep track of the index number.

var marker = createMarker( ...

(3) Then create your html links like this:
<a href="#" onclick="function()
{GEvent.trigger(myMarkers[3],'click');return false;}">Link to marker

I have placed (1) on line 16
I have placed (2) to three markers on lines 40,46,52 (the markers are the coordinated points on the map)
I have placed (3), the html links, on line 301.

Now of course there something missing since the html links are not indentified in the markers codes of (2). This is what I dont know how to do.

If this strikes your understanding please do let me know. Thank you

EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum