-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path异步.html
32 lines (31 loc) · 917 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
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta name="viewport" content="initial-scale=1.0, user-scalable=no" />
<style type="text/css">
body, html,#allmap {width: 100%;height: 100%;overflow: hidden;margin:0;font-family:"微软雅黑";}
</style>
<title>异步加载地图</title>
</head>
<body>
<div id= "allmap"></div>
</body>
</html>
<script type="text/javascript">
function loadJScript()
{
var script = document.createElement("script");
script.type = "text/javascript";
script.src = "http://api.map.baidu.com/api?v=2.0&ak=n4GwrK01fIOnpEiDkz7wy5rO&callback=init";
document.body.appendChild(script);
}
function init()
{
var map = new BMap.Map("allmap");
var point = new BMap.Point(116.404,39.915);
map.centerAndZoom(point,13);
map.enableScrollWheelZoom();
}
window.onload = loadJScript;
</script>