Why GLatLng() doesn't receive variables?
i have the following code to update a google map:
function updateit(c1,c2){
alert(c1+"-"+c2); // This works
map.setCenter(new GLatLng(c1, c2), 13); // But this doesn't
}
updateit(37.4419, -122.1419);
The alert is working and show the two coordinations, but i think the GLatLng() doesn't receive them, so the map is not upd开发者_运维问答ated unless i directly declare them as strings :
function updateit(c1,c2){
map.setCenter(new GLatLng(37.4419, -122.1419), 13); // This works
}
How to fix this problem?
Thanks
Dude, this really isn't enough
This code could be all your app does - logically it isn't and so much more is happening around it.
This looks absolutely sound. I'm simply guessing you have c1 and c2 mixed up. what does your alert say?
37.4419, -122.1419
heads straight to 1708 Fulton St
reverse them and it goes no where. Google maps does not find -122.1419, 37.4419
check that buddy.
Are you using the Google AJAX API Loader? If so I believe you have to use the google.maps.* namespace:
map.setCenter(new google.maps.LatLng(c1, c2), 13);
精彩评论