[OpenLayers-Users] Mouseover events on markers

bradleyspencer brad at cubewerx.com.au
Fri Apr 20 22:18:24 EDT 2007


I must be missing something here. I have been able to load a bunch of
markers from a MySQL database and plot as markers on OL. I also want to be
able to mouseover the marker and display the attributes in a <div> area. So
I set up the following event code within the loop that loads the markers
from an AJAX request.

marker.events.register('mouseover', marker, function(evt)
{
// Construct report data
            var atts = document.getElementById("attributes");
            atts.innerHTML = "<b><center>Koala Siting</center></b><br/>";
            atts.innerHTML += "<b>Name : </b>"+sitingName+"<br/><b>Contact :
</b>"+sitingContact+"<br/><b>siting Date: </b>"+sitingDate+"<br/><b>Time of
day : </b>"+sitingTime+"<br/><b>Siting Type : </b>"+sitingType+"<br/><b>Comm
Election Bdy : </b>"+sitingElectoralBdy+"<br/><b>Local Govt :
</b>"+sitingLocalGovt+"<br/><b>Suburb :
</b>"+sitingSuburbs+"<br/><b>Description : </b>"+sitingDescription;

            Event.stop(evt);
});

// this event just clears out the attribute data
marker.events.register('mouseout', marker, function(evt)
{
            var atts = document.getElementById("attributes");
            atts.innerHTML="";
            Event.stop(evt);
});

This also appears to work fine as all the markers trigger off the mousover
and mouseout events. But the content reported is the last processed for each
marker.

s there something really silly I’m doing here?

Cheers,


Brad Spencer
General Manager
CubeWerx Australia Pty Ltd
ABN: 37 115 163 285
Mob: +61 (0)404 841 131
Tel/Fax: +61 (0)2 9481 7024
mailto:brad at cubewerx.com.au
http://www.cubewerx.com.au

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.osgeo.org/pipermail/openlayers-users/attachments/20070421/879c0a9c/attachment.html


More information about the Users mailing list