Hello !
following code i have used for generate marker & placed where we have
clicked
when i call alert() on buttons onclick event thr' getMarkerValue()
function.
Then lat1's value is shown as Nan.
Plz help me to get value of lat1
plz check out folowing code
Give me suggestion!
ThankYou
<html xmlns="http://www.w3.org/1999/xhtml" xmlns:v="urn:schemas-
microsoft-com:vml">
<head>
<meta http-equiv="content-type" content="text/html; charset=utf-8"/
>
<title>Google Maps JavaScript API Example: Event Arguments</title>
<script src="http://maps.google.com/maps?
file=api&v=2&key=ABQIAAAAzr2EBOXUKnm_jVnk0OJI7xSosDVG8KKPE1-
m51RBrvYug
huyMxQ-i1QfUnH94QxWIa6N4U6MouMmBA"
type="text/javascript"></script>
<script type="text/javascript">
var i;
var myArray = new Array();
var map;
function initialize()
{
if (GBrowserIsCompatible())
{
i=0;
map = new GMap2(document.getElementById("map_canvas"));
map.setCenter(new GLatLng(37.4419, -122.1419), 13);
GEvent.addListener(map,"click", function(overlay,latlng)
{
if (latlng)
{
var marker=new GMarker(latlng);
myArray.push(marker.getLatLng());
map.addOverlay(marker);
alert(marker.getLatLng());
}
});
map.addControl(new GSmallMapControl());
map.addControl(new GMapTypeControl());
}
}
function getMarkerValue()
{
var mg=new GLatLng(myArray[0]);
var lat1=mg.lat();
var lng1=mg.lngRadians();
var mg1=new GLatLng(myArray[1]);
var lat2=mg1.latRadians();
var lng2=mg1.lngRadians();
var clat,clng;
alert(lat1);
//alert(myArray[0]);
}
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---