January 1, 2013

Google Map for your web page

Google Map for your web page

<script type="text/javascript" src="https://maps.google.com/maps/api/js?sensor=false"></script>
<script type="text/javascript">
function load_google_map(lat, long, target)
{
var myLatlng = new google.maps.LatLng(lat, long);
var myOptions = {
zoom: 6,
center: myLatlng,
mapTypeId: google.maps.MapTypeId.ROADMAP}
var map = new google.maps.Map(document.getElementById(target), myOptions);
var marker1 = new google.maps.Marker({ position: new google.maps.LatLng(lat, long), map: map, title: $('.locations_address').html() });
var infowindow = new google.maps.InfoWindow({ content: $('.locations_address').html() });
google.maps.event.addListener(marker1, 'click', function() { infowindow.open(map, marker1); });
}</script>

Note: You can set address string instead of lat long for your convenient.

Last updated: March 19, 2014