Newbie Problem with Marker

26 views
Skip to first unread message

kmcnet

unread,
Dec 5, 2011, 9:40:41 PM12/5/11
to google-map...@googlegroups.com
Hello Everyone and thanks for your help in advance.  I am new to Google Maps 3.0 (and not super strong in javascript).  I have an example posted at:

http://kidsmedicalcare.com/map30.htm

I have tried various versions of code to place a marker, but am having no luck.  For example:

var marker = new google.maps.Marker({
    position: new google.maps.LatLng(26.2723033, -81.7723970),
    map: map
 });

I'm not really sure what to do to get it to work.  Any help would be greatly appreciated.

geoco...@gmail.com

unread,
Dec 5, 2011, 10:13:49 PM12/5/11
to Google Maps JavaScript API v3


I get a javascript error:

Error: map is not defined
Source File: http://kidsmedicalcare.com/map30.htm
Line: 27

Your map variable is local to your initialize function.
I would suggest moving your code that creates the marker inside the
initialize function, which is initializing the map variable after the
page finishes loading.

-- Larry

kmcnet

unread,
Dec 6, 2011, 6:46:17 PM12/6/11
to google-map...@googlegroups.com
That fixed it.  Thanks for the help.
Reply all
Reply to author
Forward
0 new messages