Guest User

Untitled

a guest
Apr 25th, 2018
75
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.41 KB | None | 0 0
  1. <meta name="viewport" content="initial-scale=1.0, user-scalable=no" />
  2. <script type="text/javascript" src="http://maps.google.com/maps/api/js?sensor=false"></script>
  3.  
  4. function initialize() {
  5. var latlng = new google.maps.LatLng(0, 40);
  6. var settings = {
  7. zoom: 2,
  8. center: latlng,
  9. mapTypeControl: true,
  10. mapTypeControlOptions: {style: google.maps.MapTypeControlStyle.DROPDOWN_MENU},
  11. navigationControl: true,
  12. navigationControlOptions: {style: google.maps.NavigationControlStyle.SMALL},
  13. mapTypeId: google.maps.MapTypeId.ROADMAP
  14. };
  15. var map = new google.maps.Map(document.getElementById("map_canvas"), settings);
  16. ....
  17. }
  18.  
  19. function initialize2() {
  20. var latlng = new google.maps.LatLng(0, 40);
  21. var settings = {
  22. zoom: 2,
  23. center: latlng,
  24. mapTypeControl: true,
  25. mapTypeControlOptions: {style: google.maps.MapTypeControlStyle.DROPDOWN_MENU},
  26. navigationControl: true,
  27. navigationControlOptions: {style: google.maps.NavigationControlStyle.SMALL},
  28. mapTypeId: google.maps.MapTypeId.ROADMAP
  29. };
  30. var map2 = new google.maps.Map(document.getElementById("map_canvas2"), settings);
  31. ...
  32. }
  33.  
  34. var geocoder;
  35. var map;
  36.  
  37. function codeAddress<? echo $post['Post']['id']; ?>() {
  38. var address = "<? echo h($post['Post']['address']); ?>, <? echo h($post['Post']['ZIP']); ?> <? echo $cities[$post['Post']['city_id']]; ?>";
  39. geocoder.geocode( { 'address': address}, function(results, status) {
  40. if (status == google.maps.GeocoderStatus.OK) {
  41. map<? echo $post['Post']['id']; ?>.setCenter(results[0].geometry.location);
  42. var marker = new google.maps.Marker({
  43. map: map<? echo $post['Post']['id']; ?>,
  44. position: results[0].geometry.location
  45. });
  46. } else {
  47. alert('Geocode was not successful for the following reason: ' + status);
  48. }
  49. });
  50. }
  51.  
  52. function initialize<? echo $post['Post']['id']; ?>() {
  53. geocoder = new google.maps.Geocoder();
  54. var latlng = new google.maps.LatLng(-34.397, 150.644);
  55. var mapOptions = {
  56. zoom: 14,
  57. center: latlng
  58. }
  59. map<? echo $post['Post']['id']; ?> = new google.maps.Map($('googleMap<? echo $post["Post"]["id"]; ?>'), mapOptions);
  60. codeAddress<? echo $post['Post']['id']; ?>()
  61. }
  62.  
  63. google.maps.event.addDomListener(window, 'load', initialize<? echo $post['Post']['id']; ?>);
Add Comment
Please, Sign In to add comment