Advertisement
Guest User

Untitled

a guest
Feb 12th, 2013
2,010
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.27 KB | None | 0 0
  1. <iframe width="640" height="480" frameborder="0" scrolling="no" marginheight="0" marginwidth="0" src="https://maps.google.it/maps?q=<?php echo $yourAddress; ?>&output=embed"></iframe>
  2.  
  3. <head>
  4. ...
  5. <script src="https://maps.googleapis.com/maps/api/js?sensor=false"></script>
  6. <script>
  7. var geocoder;
  8. var map;
  9. function initialize() {
  10. geocoder = new google.maps.Geocoder();
  11.  
  12. var mapOptions = {
  13. zoom: 12, //Change the Zoom level to suit your needs
  14. mapTypeId: google.maps.MapTypeId.ROADMAP
  15. }
  16. //map_canvas is just a <div> on the page with the id="map_canvas"
  17. map = new google.maps.Map(document.getElementById('map_canvas'), mapOptions);
  18.  
  19. //Your Variable Containing The Address
  20. var address = "<?php echo $AddressVariable; ?>";
  21. geocoder.geocode( { 'address': address}, function(results, status) {
  22. if (status == google.maps.GeocoderStatus.OK) {
  23. map.setCenter(results[0].geometry.location);
  24. //places a marker on every location
  25. var marker = new google.maps.Marker({
  26. map: map,
  27. position: results[0].geometry.location
  28. });
  29. } else {
  30. alert('Geocode was not successful for the following reason: ' + status);
  31. }
  32. });
  33.  
  34. }
  35.  
  36. </script>
  37. ...
  38. </head>
  39.  
  40. <body onload="initialize()">
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement