Hello All,
I am having some issues with adding a marker to the google map that
has a GEventListener attached to it.
What I want to do: Have a map with X markers on it and each marker
when clicked links to another page. I do not want an infoWindow to
pop up, nor do I want it to do anything but navigate away from the
current page its on.
Standard xhtml page with a <div> set aside to hold map. Javascript
code follows:
<script type="text/javascript">
//global variable declarations
var map;
var coor;
function initialize() {
if (GBrowserIsCompatible()) {
//single point of control over coordinates of map
//for possible additional scripting in future
coor = new GLatLng(39.993089, -82.555245);
//construct new map with attached ID
map = new GMap2(document.getElementById("map"));
//use coordinates established above with zoom specified here
map.setCenter(coor, 7);
//add Google's Small Map Control buttons
//includes: map positioning, and zoom
map.addControl(new GLargeMapControl());
//add Google's Map Type buttons
//includes: Map, Satellite, Hybrid
//map.addControl(new GHierarchicalMapTypeControl());
//add columbus to main map
coor = new GLatLng(39.997002, -83.011336);
map.addOverlay(new GMarker(coor), GEvent.addListener(map, "click",
function() { window.location.href = "../3.2/cols/"; }));
//add Newark to main map
coor = new GLatLng(40.069753, -82.443645);
map.addOverlay(new GMarker(coor), GEvent.addListener(map, "click",
function() { window.location.href = "../3.2/newk/"; }));
//add Mansfield to main map
coor = new GLatLng(40.798604, -82.577928);
map.addOverlay(new GMarker(coor), GEvent.addListener(map, "click",
function() { window.location.href = "../3.2/mans/"; }));
//add Wooster to main map
coor = new GLatLng(40.774622, -81.924306);
map.addOverlay(new GMarker(coor), GEvent.addListener(map, "click",
function() { window.location.href = "../3.2/woos/"; }));
}//closing of if statement
}//closing of function Initialize()
//GSearch.setOnLoadCallback(initialize);
</script>
All four markers placed on the map are clickable the problem comes in
that each links to the same page, specifically, "../3.2/woos/".
Anyone have any suggestions? Much appreciated in advance and thanks
for the help...
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---