On Mar 23, 10:05 pm, iyanghao <[email protected]> wrote:
> I defined a var map in my index html ,but when i use GEventaddListener
> () in a .js file cause an error map undefine.what should I do?
> =============================================================
> index html code:
> <head>
> <script type="text/javascript" src="./rt3.js"></script>
> <script type="text/javascript">
> var map;
> function initial()
> {
>     map = new GMap2(document.getElementById("id1"));
>     map.addControl(new GOverviewMapControl());
>         map.setCenter(new GLatLng(39.917, 116.397), 14);}
>
> </script>
> </head>
> <body onload="initial()" onunload="GUnload()">
> <div id="id1" style="width:680px;height:560px"></div>
> </body>
> </html>
> --------------------------------------------------------------------------- 
> ------------------------------------------------
> rt3.js code:
> GEvent.addListener(map,"click",function(overlay,latlng)
> {var marker=new GMarker(this.latlng,{dragable:true});
>                          map.addOverlay(marker);});
> ===========================================================
> I tried to add <script type="text/javascript" src="./rt3.js"></
> script> behind the<script>function initial(){ }</script> But that
> cause an main.js error
> what shoud I do?

You didn't like the answers here?
http://groups.google.com/group/Google-Maps-API/browse_frm/thread/41597bd8c9d54360#

please follow the posting guidelines and post a link to your map so we
can help you.

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