Posted By

marzsman on 05/14/11


Tagged

javascript google maps


Versions (?)

Initialize Google maps V3


 / Published in: JavaScript
 

Basic Google Maps initialize code

  1. var map;
  2. function initialize() {
  3. var myLatlng = new google.maps.LatLng(51.05866,3.713379);
  4. var myOptions = {
  5. zoom: 8,
  6. center: myLatlng,
  7. streetViewControl: false,
  8. mapTypeId: "terrain",
  9. scrollwheel:false
  10. }
  11. map = new google.maps.Map(document.getElementById("'.$id.'"), myOptions);
  12. mapReady();
  13. }
  14. function mapReady() {
  15. //Go wild
  16. }
  17. function loadScript() {
  18. var script = document.createElement("script");
  19. script.type = "text/javascript";
  20. script.src = "http://maps.google.com/maps/api/js?sensor=false&callback=initialize";
  21. document.body.appendChild(script);
  22. }
  23. window.onload = loadScript;

Report this snippet  

You need to login to post a comment.