var geocoder; var map; function initialize() { geocoder = new google.maps.Geocoder(); var latlng = new google.maps.LatLng(-34.397, 150.644); var mapOptions = { zoom: 16, scrollwheel: false, center: latlng, mapTypeId: google.maps.MapTypeId.ROADMAP } map = new google.maps.Map(document.getElementById("map-canvas"), mapOptions); codeAddress(); } function codeAddress() { var address = "28410 B Avenue Stanford Santa Clarita, CA 91355"; geocoder.geocode( { 'address': address}, function(results, status) { if (status == google.maps.GeocoderStatus.OK) { map.setCenter(results[0].geometry.location); var marker = new google.maps.Marker({ map: map, position: results[0].geometry.location, markers: [ { 'address': results[0].geometry.location } ] }); } else { showErrorMessage("We couldn't map your address. Try changing the format and order of each element of your address. Error: " + status); } }); } google.maps.event.addDomListener(window, 'load', initialize);