<script type="text/javascript">
//<![CDATA[
function createMarker(point, name)
{
var marker = new GMarker(point, {title:name});
return marker;
}
function mapclick(ov,pt)
{
if (marker) map.removeOverlay(marker);
if (pt) { marker = createMarker(pt,pt.toUrlValue());
map.addOverlay(marker);
}
var matchll = /\(([-.\d]*), ([-.\d]*)/.exec(pt);
if (matchll)
{
var lat = parseFloat( matchll[1] );
var lon = parseFloat( matchll[2] );
lat = lat.toFixed(6);
lon = lon.toFixed(6);
}
document.getElementById("lat").value = lat;
if(document.getElementById("lat").value == "undefined")
{
document.getElementById("lat").value = "";
}
document.getElementById("lon").value = lon;
if(document.getElementById("lon").value == "undefined")
{
document.getElementById("lon").value = "";
}
}
if (GBrowserIsCompatible())
{
var map=new GMap2(document.getElementById("map"));
map.setCenter(new GLatLng(53.558584,-7.987061), 6);
map.addControl(new GLargeMapControl());
var marker = null;
GEvent.addListener(map,\'click\',function(overlay,point){mapclick(overlay,point)});
}
//]]>
</script>
var marker = new google.maps.Marker({ position: (53.558584,-7.987061), map: map });
I'm getting the below error and can't seem to figure it out, is it the format that position is in is incorrect!?
Invalid value for property <position>: -7.987061
The documentation says
position LatLng Marker position. Required.
So it needs to be a LatLng, not a couple of numbers.
http://code.google.com/apis/maps/documentation/javascript/reference.html#LatLng
var marker = new google.maps.Marker({