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&amp;v=2&amp;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.

Recommended Answers

All 2 Replies

What does this have to do with PHP? It looks like you need to post this in the Javascript forum.

What does this have to do with PHP? It looks like you need to post this in the Javascript forum.

Of course, sorry.
Can please the moderator move this post to the JS forum? Thanks and yet one more time sorry

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.