/ Published in: JavaScript
This javascript will create a google map on the div with the ID "the_map" and centered on an address with a marker on it. In this example the address is for Jet City Improv. More information on setup and customization at the link.
Expand |
Embed | Plain Text
Copy this code and paste it in your HTML
window.onload = function(){ var geocoder = new google.maps.Geocoder(); geocoder.geocode({'address':'5510 University Way NE Seattle, WA 98105'},function(result,status){ if(status==google.maps.GeocoderStatus.OK){ var map = new google.maps.Map(document.getElementById("the_map"),{ 'center': result[0].geometry.location, 'zoom': 14, 'streetViewControl': false, 'mapTypeId': google.maps.MapTypeId.TERRAIN, 'noClear':true, }); new google.maps.Marker({ 'map': map, 'position': result[0].geometry.location, }); }else{ alert('Address not found!'); } }); }