google地图API的简单使用

<div id="contact_container" style="width:700px;height:600px;"></div>
<script type="text/javascript">
function initialize() {
   var myLatlng = new google.maps.LatLng(39.95745,116.32764);
   var myOptions = {
     zoom: 18,
     center: myLatlng,
     mapTypeId: google.maps.MapTypeId.ROADMAP
   }
   var map = new google.maps.Map(document.getElementById("contact_container"), myOptions);
   var marker = new google.maps.Marker({
      position: map.getCenter(),
      map: map,
      title: ‘CAAS‘
    });
 }
   
 function loadScript() {
   var script = document.createElement("script");
   script.type = "text/javascript";
   script.src = "
http://maps.google.com/maps/api/js?language=en&sensor=false&callback=initialize";
   document.body.appendChild(script);
 }
   
 window.onload = loadScript;
</script>

google地图API的简单使用

上一篇:组件接口(API)设计指南[3]-委托(delegate)和数据源协议(data-source protocols)


下一篇:MonkeyDevcie API 实践全记录