goole map API实例

第一个:

<html>
 <head>
 <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
  <meta name="viewport" content="initial-scale=1.0, user-scalable=no" />
 <script type="text/javascript" src=\'#\'" >http://maps.google.com/maps/api/js?sensor=false"></script>
  <script type="text/javascript">
  function initialize()
  { 
  var latlng = new google.maps.LatLng(22.538879564256025, 114.11844713783264); //22.538879564256025, 114.11844713783264为经纬度
   var myOptions = {
      zoom: 15,    //缩放大小
      center: latlng,
      mapTypeId: google.maps.MapTypeId.ROADMAP
    }
    var map = new google.maps.Map(document.getElementById("map_canvas"), myOptions);
    //添加一个标记
    var marker = new google.maps.Marker({
        position: latlng,
        map: map,
        title:"Hello World!\n电话:13713731383"
    });  
  }
  </script>
   </head>
   <body onLoad="initialize()"> 
    <div id="map_canvas" style="width:400px;; height:400px;"></div>
   
    <div>
    google Map经纬度坐标取得方法<br>

  首先打开Google地图,在上面寻找一个地址,然后上下左右移动地图,让这个地址正好处于地图的正中心位置,当您想寻找坐标位置已经处于地图的中心位置的时候,拷贝并粘贴以下代码到你的浏览器地址栏:<br/>

  javascript:void(prompt('',gApplication.getMap().getCenter())); <br/>

  这时,你将得到一个弹出式的坐标,这个坐标就是你需要找的经度和纬度<br/>
    </div>
     </body>  
 </html>

第二个:

<html>
 <head>
 <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
  <meta name="viewport" content="initial-scale=1.0, user-scalable=no" />
 <script type="text/javascript" src=\'#\'" >http://maps.google.com/maps/api/js?sensor=false"></script>
  <script type="text/javascript">
  function initialize()
  { 
  var myLatlng = new google.maps.LatLng(22.538879564256025, 114.11844713783264); //22.538879564256025, 114.11844713783264为经纬度
   var myOptions = {
      zoom: 15,    //缩放大小
      center: myLatlng,
      mapTypeId: google.maps.MapTypeId.ROADMAP
    }
    var map = new google.maps.Map(document.getElementById("map_canvas"), myOptions);
    //添加一个标记
    var contentString = '<div id="content">Welcome ITA-Solution<br/>联系电话:15013870009</div>'; 
 var infowindow = new google.maps.InfoWindow({     content: contentString }); 
 var marker = new google.maps.Marker({     position: myLatlng,     map: map,     title:"Uluru (Ayers Rock)" });
 google.maps.event.addListener(marker, 'click', function() {   infowindow.open(map,marker); });
  }
  </script>
   </head>
   <body onLoad="initialize()"> 
    <div id="map_canvas" style="width:400px;; height:400px;"></div>
     </body>  
 </html>

你可能感兴趣的:(api,职场,Google,map,休闲)