-
Notifications
You must be signed in to change notification settings - Fork 0
/
地图模式.html
44 lines (37 loc) · 1014 Bytes
/
地图模式.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>地图模式</title>
<style type="text/css">
#cont{
width: 800px;
height: 400px;
margin: 30px auto;
}
</style>
</head>
<body>
<div id="cont"></div>
</body>
<script type="text/javascript" src="http://webapi.amap.com/maps?v=1.3&key=c50c1b44b58be56e6fd9a8b9742f0aac"></script>
<script type="text/javascript">
var map = new AMap.Map('cont',{
zoom:10
});
var marker = new AMap.Marker({
position: [114.261139,30.627565],//marker所在的位置
map:map,//创建时直接赋予map属性
// icon:"imgs/wjx.png"
});
//也可以在创建完成后通过setMap方法执行地图对象
marker.setMap(map);
// 信息窗口
marker.on('click',function () {
var infoWindow = new AMap.InfoWindow({
content: '<p>你好</p>' //使用默认信息窗体框样式,显示信息内容
});
infoWindow.open(map, [114.261139, 30.627565]);
});
</script>
</html>