Hi, after the page has allready loaded I'm trying to get another javascript function to add a marker on the loaded map. The below is a short version of what I'm trying to do based on the API examples, but it does not add the marker... what am I missing? Any ideas?
thanks in advance <!DOCTYPE html> <html> <head> <title>Google Maps JavaScript API v3 Example: Marker Simple</title> <link href="http://code.google.com/apis/maps/documentation/javascript/examples/default.css" rel="stylesheet" type="text/css" /> <script type="text/javascript" src="//maps.googleapis.com/maps/api/js?sensor=false"></script> <script type="text/javascript"> function callafunction(){ var latlng = new google.maps.LatLng(-25.363882,131.044922); marker = new google.maps.Marker({ position: latlng, map: map }); } function initialize() { var myLatlng = new google.maps.LatLng(-25.363882,131.044922); var myOptions = { zoom: 4, center: myLatlng, mapTypeId: google.maps.MapTypeId.ROADMAP } var map = new google.maps.Map(document.getElementById("map_canvas"), myOptions); } </script> </head> <body onload="initialize()"> <form id="callafunction" action="#" onSubmit="return false;"> <input type="submit" value="callafunction" onClick="callafunction(); return false;"/> </form> <div id="map_canvas"></div> </body> </html> -- You received this message because you are subscribed to the Google Groups "Google Maps JavaScript API v3" group. To view this discussion on the web visit https://groups.google.com/d/msg/google-maps-js-api-v3/-/QyLuqvjppI8J. 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-js-api-v3?hl=en.
