Hi there,
I solve all day long a problem with error "a is undefined".
I have 2 pages -- index and the second page. On the second page I shows google map in div and all is alright.
But on index page I get error message given in subject this thread (on index page is not div with google map).
I am including this code to my page:
<script type="text/javascript" src="http://maps.google.com/maps?
file=api&v=2&key=my_key"></script>
<script>
$(function(){
function createMarker(point){
var marker = new GMarker(point, {draggable: true});
GEvent.addListener(marker,"mouseup",function(){
$("#location").val(marker.getPoint().lat());
$("#frmfirstForm-gmap_lat").val(marker.getPoint().lat());
$("#frmfirstForm-gmap_lng").val(marker.getPoint().lng());
});
return marker;
}
function setLocation(zip){
var geocoder = new GClientGeocoder();
geocoder.setBaseCountryCode('cz');
geocoder.getLocations(zip, function(locations){
if(locations.Status.code === 200){
// toSource not for IE!!!
var p = locations.Placemark[0].Point;
//setup globaly vars for show image-map in summary page
lat = p.coordinates[1];
lng = p.coordinates[0];
var loc = new GLatLng(p.coordinates[1],
p.coordinates[0]);
map.addOverlay(createMarker(loc));
map.setCenter(loc);
}
});
}
var map = new GMap2($("#gmap").get(0));
map.addControl(new GLargeMapControl());
var loc_lat = 49.3268;
var loc_lng = 17.9966;
var location = new GLatLng(loc_lat, loc_lng);
$("#frmfirstForm-gmap_lat").val(loc_lat);
$("#frmfirstForm-gmap_lng").val(loc_lng);
});
</script>
Can you help me, please, how this error message remove?
Thank you very much.