• 编程经验:Google Maps JavaScript API Example


     

     

    <script src="http://ditu.google.cn/maps?file=api&amp;v=2&amp;key=ABQIAAAAFdUKFVuLyGlw8qKw1cVf_RTMjetJEhrR1R1RvCXjRPxALNPQwRTHOwBUUq3bsuOeLc1M7JjWKjuIBA&sensor=false&hl=zh-CN" type="text/javascript"></script>
       <script type="text/javascript">

     

        function initialize() {

          if (GBrowserIsCompatible()) {

            var map = new GMap2(document.getElementById("map_canvas"));

            map.setCenter(new GLatLng(39.917, 116.397), 14);

           

            map.addControl(new GSmallZoomControl());

            // Add a marker to the map at the location

            var bounds = map.getBounds();

            var southWest = bounds.getSouthWest();

            var northEast = bounds.getNorthEast();

            var lngSpan = northEast.lng() - southWest.lng();

            var latSpan = northEast.lat() - southWest.lat();

            var point = new GLatLng(39.917, 116.397);

            map.addOverlay(new GMarker(point));

          }

        }

        </script>

      <body onload="initialize()" onunload="GUnload()">

        <div id="map_canvas" style=" 500px; height: 300px"></div>

      </body>

     

    查看更多精彩图片

  • 相关阅读:
    杂篇章
    敲代码中遇到的小问题
    数组的运用
    java中强大的免费的集成开发环境(IDE)eclipse的使用技巧及注意事项
    流程
    博客目录
    pgk
    gogs
    github相关
    axios记录
  • 原文地址:https://www.cnblogs.com/Gemgin/p/3136305.html
Copyright © 2020-2023  润新知