If I understand correctly, you want to open an info window when you
hover over the link.
There are a few ways of doing this.
The way I would go about it, using only core JavaScript, is quite
simple.
For each of the links that you want to add the hover map effect to an
id field. Make this field unique to each link, something like the name
of the hotel with all spaces replaced with _ (assuming the hotel names
are unique).
Add to your XML structure a "linkId" attribute and make the this match
the unique id of the link above, follow?
Once that's done, it's a simple case of changing your javascript
thusly:
function load()
{
if (GBrowserIsCompatible())
{
var map = new GMap2(document.getElementById("map"));
map.addControl(new GSmallMapControl());
map.addControl(new GMapTypeControl());
map.setCenter(new GLatLng(20.88,-156.5), 10);
GDownloadUrl(
"mapdata.php?page=Maui",
function(data, responseCode)
{
// To ensure against HTTP errors that result in
null or bad data,
// always check status code is equal to 200
before processing the
data
if(responseCode == 200)
{
var xml = GXml.parse(data);
var markers =
xml.documentElement.getElementsByTagName("marker");
for (var i = 0; i < markers.length; i++)
{
var hotelname =
markers[i].getAttribute("hotelname");
var addr1 =
markers[i].getAttribute("addr1");
var description =
markers[i].getAttribute("description");
var marker = createMarker(
new GLatLng(
parseFloat(markers[i].getAttribute("lat")),
parseFloat(markers[i].getAttribute("lng"))
),
hotelname,
addr1,
description
);
map.addOverlayMarker;
}
}
else if(responseCode == -1)
{
alert("Data request timed out. Please
try later.");
}
else
{
alert("Request resulted in error. Check
XML file is
retrievable.");
}
}
);
}
}
function createMarker(point, hotelname, addr1, description)
{
var html = "<b>" + hotelname + "</b> <br/>" + addr1 ;
var marker = new GMarker(point);
GEvent.addDomListenerListener(
document.getElementById(markers[i].getAttribute('linkId')),
'mouseover',
function(e)
{
marker.addListener(
marker,
'click',
function()
{
marker.openInfoWindow(html);
}
)
}
);
GEvent.addListener(
marker,
'click',
function(e)
{
marker.addListener(
marker,
'click',
function()
{
marker.openInfoWindow(html);
}
)
}
)
return marker;
}
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---