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 like this:
<script type="text/javascript" src="./test.js"></script>
<script type="text/javascript">
var map;
function initial()
{
    var map=map = new GMap2(document.getElementById("id1"));
    ........
    ........
}
</script>
<body onload="initial()" onunload="GUnload">
</body>
---------------------------------------------------------------------------------------------------------------------------
test.js code like this:
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="./test.js"></
script> behind the<script>function initial(){ }</script> But that
cause an main.js error
what shoud I do?

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