Reputation: 51
I want to get parameter from function
function initialize(myPin,myCen) {
var myLatlng = new google.maps.LatLng(myPin);
var mapOptions = { center: new google.maps.LatLng(myCen) }
....
}
I have my Pin(lat,long) and Map center(lat,long)
myPin = 12345,12345;
myCen = 12355,12355;
google.maps.event.addDomListener(window, 'load', initialize(myPin,MyCen);
Result not work please help
Upvotes: 0
Views: 1826
Reputation: 161334
The google.maps.event.addDomListener function takes a function pointer as its argument. You can use a pointer to an anonymous function:
google.maps.event.addDomListener(window, 'load', function() {
initialize(myPin,MyCen)
});
Upvotes: 1
Reputation: 9782
you can try like this
window.onload=function() {
google.maps.event.initialize(myPin,MyCen);
}
Upvotes: 0