Advertisement
Guest User

Untitled

a guest
Aug 4th, 2011
183
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
HTML 1.53 KB | None | 0 0
  1. <!doctype html>
  2. <html>
  3. <head>
  4.     <meta charset="utf-8">
  5.     <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
  6.     <title></title>
  7.     <script type="text/javascript">
  8.         function initialize() {
  9.             var myLatlng = new google.maps.LatLng(30,0);
  10.             var myOptions = {
  11.               zoom: 2,
  12.               center: myLatlng,
  13.               mapTypeId: google.maps.MapTypeId.TERRAIN
  14.           }
  15.  
  16.           var map = new google.maps.Map(document.getElementById("map"), myOptions);
  17.  
  18.           var countries = Array();
  19.  
  20.           countries.push({
  21.               marker: new google.maps.Marker({position: new google.maps.LatLng(4.52,115), map: map, title: 'Test'}),
  22.               infowindow: new google.maps.InfoWindow({content: "Hello world"})
  23.           });
  24.           countries.push({
  25.               marker: new google.maps.Marker({position: new google.maps.LatLng(42.45,23.20), map: map, title: 'Test2'}),
  26.               infowindow: new google.maps.InfoWindow({content: "Hello world2"})
  27.           });
  28.           countries.push({
  29.               marker: new google.maps.Marker({position: new google.maps.LatLng(12.15,-1.30), map: map, title: 'Test3'}),
  30.               infowindow: new google.maps.InfoWindow({content: "Hello world3"})
  31.           });
  32.  
  33.           for each (var item in countries) {
  34.               google.maps.event.addListener(item.marker, 'click', function() {
  35.                 item.infowindow.open(map, item.marker);
  36.               });
  37.          }
  38.          }
  39.     </script>
  40. </head>
  41.  
  42. <body onload="initialize();">
  43.     <div id="map" style="width:500px; height:500px; border:1px solid red;"></div>
  44.        
  45.     <script type="text/javascript" src="http://maps.google.co.uk/maps/api/js?sensor=false"></script>
  46.     </body>
  47. </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement