I initialize my map and webpage with:
<body onload="initialize()" onunload="GUnload()">
The user sets a few parameters, clicks a button, some server side code
is executed, I build up a JSON object of points, and
RegisterClientScriptBlock on the JSON from .net, and pass the points
to client side javascript "addPoints".
Problem is, when i come back into addPoints, I can't get any reference
to "map". I guess it has something to do with order of things
initializing - i've tried calling initialize() from addPoints(), to
reinitialize things, I've tried making "map" variable global, but
nothing seems to work - help!
<script type="text/javascript">
function initialize() {
debugger;
var map = new GMap2(document.getElementById("map"));
map.addControl(new GLargeMapControl());
map.addControl(new GMapTypeControl());
map.setCenter(new GLatLng(51.5, -0.125), 11);
}
function addPoints(myHotSpots) {
debugger;
var map = new
google.maps.Map2(document.getElementById("map"));
for (var p in myHotSpots){
var point = new GPoint(p.lon, p.lat);
map.addOverlay(point);
}
}
</script>
--
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.