javascript高德地图放到网页中的方法
1 先获取到经纬度
http://lbs.amap.com/console/show/picker
2 下面代码直接设置下中心点 和标记点就可以了
<!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>点标记</title>
<link rel="stylesheet" href="http://cache.amap.com/lbs/static/main1119.css"/>
<style>
.marker {
color: #ff6600;
padding: 4px 10px;
border: 1px solid #fff;
white-space: nowrap;
font-size: 12px;
font-family: "";
background-color: #0066ff;
}
</style>
<script src="http://webapi.amap.com/maps?v=1.3&key=输入key值"></script>
<script type="text/javascript" src="http://cache.amap.com/lbs/static/addToolbar.js"></script>
</head>
<body>
<div id="container"></div><script>
var marker, map = new AMap.Map("container", {
resizeEnable: true,
center: [123.17699, 33.21674],
zoom: 16
});
marker = new AMap.Marker({
icon: "http://webapi.amap.com/theme/v1.3/markers/n/mark_b.png",
position: [123.17699, 33.21674]
});
marker.setMap(map);</script>
</body>
</html>
原创文章,作者:奋斗,如若转载,请注明出处:https://blog.ytso.com/18804.html