Seems that this does not solve the problem. I changed the code, so it
looks like this now:


<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd";>
<html xmlns="http://www.w3.org/1999/xhtml";  xmlns:v="urn:schemas-
microsoft-com:vml">
 <head>
   <title>Google Maps JavaScript API Example: Simple Directions</
title>
   <meta http-equiv="content-type" content="text/html; charset=UTF-8"/
>
   <script src="http://maps.google.com/maps?
file=api&v=2.x&key=ABQIAAAAzr2EBOXUKnm_jVnk0OJI7xSosDVG8KKPE1-
m51RBrvYughuyMxQ-i1QfUnH94QxWIa6N4U6MouMmBA"
     type="text/javascript"></script>
   <script type="text/javascript">

   var map;
   var directionsPanel;
   var directions;
   var waypoints = new Array("...");
   var information = new Array("...");


function handleEvents(marker, ind)
{
        Event.addListener(marker, "mouseover",
                function()
                {
                marker.openInfoWindowHtml(information[ind]);
                }
        );
   
        GEvent.addListener(marker, "mouseout",
                function()
                {
                map.closeInfoWindow();
        }
        );
}

function initialize()
{
    map = new GMap2(document.getElementById("map_canvas"));
    map.setCenter(new GLatLng(48.16014,11.566864), 15);

        var mapControl = new GMapTypeControl();
        map.addControl(mapControl);
        map.addControl(new GLargeMapControl());

    directionsPanel = document.getElementById("route");
    directions = new GDirections(map, directionsPanel);
    directions.loadFromWaypoints(waypoints);
        GEvent.addListener(directons, "load",
                function()
                {
                        for(var i=1; i<waypoints.length; i++)
                        {
                                var marker = directons.getMarker(i);
                        handleEvents(marker, i);
                        }
                }
        );
}
   </script>
 </head>

 <body onload="initialize()">
   <div id="map_canvas" style="width: 70%; height: 480px; float:left;
border: 1px solid black;"></div>
   <div id="route" style="width: 25%; height:480px; float:right;
border; 1px solid black;"></div>
   <br/>
 </body>
</html>

But the script acts like it does before. I got no idea why...

On 8 Okt., 18:10, Mike Williams <[EMAIL PROTECTED]> wrote:
> Wasn't it Felix who wrote:
>
>
>
> >Is it anyhow possible to access and manipulate the marker variable,
> >which i want to get displayed? I don't have a clue yet.
>
> Yes. Just do what you were doing, but use a function to contain the
> GEvent calls and obtain function closure for one marker.
>
>   function handleEvents(marker) {
>     GEvent.addListener(marker, "mouseover", function() {
>       marker.openInfoWindowHtml(information[i]);
>     });
>     GEvent.addListener(marker, "mouseout", function() {
>       map.closeInfoWindow();
>     });
>   }
>
>   GEvent.addListener(directons, "load", function() {
>     for(var i=0; i<waypoints.length; i++) {
>       var marker = directons.getMarker(i);
>       handleEvents(marker);
>     }
>   });
>
> And use map.closeInfoWindow() rather than marker.closeInfoWindow()
>
> --http://econym.org.uk/gmap
> The Blackpool Community Church Javascript Team
--~--~---------~--~----~------------~-------~--~----~
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