Hi,

Mouseover event is not working because, you missed one letter in the
name of event (line 152):
GEvent.addListener(marker2, 'mousover', function() {

it should be:
GEvent.addListener(marker2, 'mouseover', function() {

considering the first problem - all data is passed by a reference, so
when you change variables like sanc_name etc., they are changing in
all markers.
The simple solution is prepare function to create markers - then data
is cloning:

function createMarker(sanc_name, sanc_address, sanc_website,
sanc_telephone, sanc_lat, sanc_lon) {

        var icon2 = new GIcon();
        icon2.image = "http://maps.google.com/mapfiles/arrow.png";;
        icon2.shadow = "http://maps.google.com/mapfiles/arrowshadow.png";;
        icon2.iconSize = new GSize(40, 40);
        icon2.shadowSize = new GSize(37, 34);
        icon2.iconAnchor = new GPoint(10, 34);


        var marker2 = new GMarker(new GLatLng(sanc_lat,sanc_lon),icon2);
        map.addOverlay(marker2);

        GEvent.addListener(marker2, 'click', function() {
                window.open(sanc_website, "_self");
        });

        GEvent.addListener(marker2, 'mouseover', function() {
                map.openInfoWindow(new GLatLng(sanc_lat,sanc_lon), ''+sanc_name
+'<br>'+sanc_address+'<br>'+sanc_telephone);
        });
}

and then you have to change code in function searchResults:

...
                                // Now create html list
                                
document.getElementById('search_results').innerHTML =
generated_html;

                                createMarker(sanc_name, sanc_address, 
sanc_website,
sanc_telephone, sanc_lat, sanc_lon);

                                // Create layer based on lat, lon, infotext, 
clickable green icon
...

Regards,
Michal Biniek


On 10 Gru, 22:34, "[email protected]" <paul.lee.
[email protected]> wrote:
> Hi,
> I'm experimenting with googlemaps and I'm impressed by what I have
> seen so far. I have a few questions to ask though.
>
> I'm trying to create a map which has a few markers (less than 5) on
> it, each denoted by an icon: the algorithm that places the icons on
> screen is in a for.. loop. Now, I can place the icons/markers on the
> map and I am trying to make it so that when the user puts his
> mouseover the icon, you get an InfoWindowHTML pop-up, and when you
> click on the icon, you are taken to another website.
>
> My interim page is at  http://paullee.com/secondchance/secondchance.php
>
> However, I have a number of problems: the first is that the 'click'
> event only ever seems to store the
> last URL extracted from the Ajax obtained XML file. So, no matter what
> icon I click on, I get redirected to the same, last entry XML url.
> The other point is that the mouseover event doesn't work, so no
> infowindow pop-up.
>
> Is there something obviously wrong?
>
> Best wishes

--

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.


Reply via email to