Go Back   CodingForums.com > :: Client side development > JavaScript programming

Before you post, read our: Rules & Posting Guidelines

Reply
 
Thread Tools Rate Thread
Enjoy an ad free experience by logging in. Not a member yet? Register.
Old 09-05-2008, 08:35 AM   PM User | #1
mikacruz
Regular Coder

 
Join Date: Dec 2007
Location: on earth
Posts: 183
Thanks: 49
Thanked 2 Times in 2 Posts
mikacruz is an unknown quantity at this point
Javascript into google map

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.
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
event.

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

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

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

var marker = createMarker( ...
myMarkers.push(marker)

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


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
mikacruz is offline   Reply With Quote
Reply

Bookmarks

Jump To Top of Thread


Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 09:57 AM.


Advertisement
Log in to turn off these ads.