博文

目前显示的是 八月, 2017的博文

google map api简单范例geolocation代码及自己注释

<!DOCTYPE html> <html>   <head>     <title>Geolocation</title>     <meta name="viewport" content="initial-scale=1.0, user-scalable=no">     <meta charset="utf-8">     <style>       /* Always set the map height explicitly to define the size of the div        * element that contains the map. */       #map {         height: 100%;       }       /* Optional: Makes the sample page fill the window. */  /* map包含在body中,使用百分比表达时,是根据父容器的大小决定的,所以body html必须写为100% */  html, body {         height: 100%;         margin: 0;         padding: 0;       }     </style>   </head>   <body>     <div id="map"></div>     <script>       // Note: This example requires that you consent to location sharing when       // prompted by your browser. If you see the error "The Geolocation service       // failed.", it means you probably did not give permission