<!doctype html>
<html>
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="initial-scale=1.0, user-scalable=no, width=device-width">
<title>地图初始IP城市定位</title>
<link rel="stylesheet" href="https://a.amap.com/jsapi_demos/static/demo-center/css/demo-center.css"/>
<style type="text/css">
html,body,#container{
height:100%;
}
.info{
width:20rem;
}
</style>
</head>
<body>
<div id="container" style="display: block"></div>
<div class="info">
<p>At initialization map, central city center property if the user is a default, the default map to locate </ the p- > < HR >
< the p- the above mentioned id = 'adcode' > </ the p- >
</ div >
< Script of the type = "text / JavaScript " src =" https://webapi.amap.com/maps?v=1.4.15&key=434ba809f44484dcac6b4863b67ee4aa " > </ Script >
< Script of the type =" text / JavaScript " >
// initialize the map, if the center attribute is missing Province, maps default to the user's city center
var the map = new new AMap.Map ( ' Container ', {
resizeEnable: true
});
document.getElementById ( ' adcode ' ) .innerHTML = ' Current City adcode: ' + map.getAdcode () + ' <br> ' + ' current center point: ' + map.getCenter ();
the console.log (Map)
< / Script >
</ body >
</ HTML >