简单的不解释,直接上代码
<!doctype html>
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="chrome=1">
<meta name="viewport" content="initial-scale=1.0, user-scalable=no, width=device-width">
<style type="text/css">
body,html,#container{
height: 100%;
margin: 0px;
}
/*給地图容器指定大小*/
#container {
width:800px;
height: 800px;
}
</style>
<title>快速入门</title>
</head>
<body>
<div id="container"></div>
<!-- 在页面中引入高德地图JavaScript API入口脚本 -->
<script type="text/javascript" src="http://webapi.amap.com/maps?v=1.3&key=2db07ff25f767d05078fd8a9977a5c66"></script>
<script type="text/javascript">
// 创建地图
var mapObj = new AMap.Map('container',{
resizeEnable: true,
zoom: 10,
// center属性的值可以是经纬度的二元数组,
// 也可以是AMap.LngLat对象,要求经度值在前,纬度值在后:
center: [116.39, 39.9]
});
// 给地图添加点标记等覆盖物
var marker = new AMap.Marker({
//marker所在的位置
position: [116.480983, 39.989628],
//创建时直接赋予map属性
map:mapObj
});
</script>
</body>
</html>