You have a global 'map' variable, but in your initialize() function,  
you create a local one. Instead of var map = ..., just make it map = ...

Also:
http://groups.google.com/group/Google-Maps-API/web/suggested-posting-guidelines
http://groups.google.com/group/Google-Maps-API/web/why-including-a-link-is-critical

-G

On Jun 30, 2009, at 9:00 AM, RandF wrote:

>
> Hi @ all
>
> I got a problem... If I to do a jump on a map, I use this code...
>
> Javascript:
> var map;
>
>        function initialize() {
>        if (GBrowserIsCompatible()) {
>        var map = new GMap2(document.getElementById("map_canvas"));
>        map.setCenter(new GLatLng(47.04858975776473, 8.259680271148681),
> 15);
>        map.enableScrollWheelZoom();
>        var mapControl = new GMapTypeControl();
>        map.addControl(mapControl);
>        map.addControl(new GLargeMapControl());
>        //Gasshof 1, Littau
>        var point = new GLatLng(47.04858975776473, 8.259680271148681)
>        map.addOverlay(new GMarker(point));
>        //Engehaldestrasse 131, Bern
>        var point2 = new GLatLng(46.96178875223457, 7.441821098327637)
>        map.addOverlay(new GMarker(point2));
>        //Hauptstrasse 97, Pratteln BL
>        var point3 = new GLatLng(47.518736, 7.699307)
>        map.addOverlay(new GMarker(point3));
>
>        }
> }
>
>        //Springe zu Littau
>    function littau() {
>      map.panTo(new GLatLng(47.04858975776473, 8.259680271148681));
>    }
>
>        //Springe zu Bern
>    function bern() {
>      map.panTo(new GLatLng(46.96178875223457, 7.441821098327637));
>    }
>
>        //Springe zu Pratteln
>    function pratteln() {
>      map.panTo(new GLatLng(47.518736, 7.699307));
>    }
>
> ------------------------------------------------
>
> HTML form:
>
>      <tr>
>       <td><form action="#" onsubmit="littau(); return
> false"><p><input type="submit" value="Littau anzeigen" /></p></td>
>        <td><form action="#" onsubmit="bern(); return false"><p><input
> type="submit" value="Bern anzeigen" /></p></td>
>        <td><form action="#" onsubmit="pratteln(); return
> false"><p><input type="submit" value="Pratteln anzeigen" /></p></td>
>       </tr>
>
> ---------------------------------------------
>
> Where am I doing something wrong?
>
> >


--~--~---------~--~----~------------~-------~--~----~
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