码迷,mamicode.com
首页 > Web开发 > 详细

js 地图功能

时间:2016-12-28 12:11:45      阅读:237      评论:0      收藏:0      [点我收藏+]

标签:utf-8   ini   tle   doctype   src   head   append   poi   llb   

<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8"/>
<title>异步加载</title>
<script type="text/javascript">
function initialize() {
var mp = new BMap.Map(‘map‘);
mp.centerAndZoom(new BMap.Point(121.491, 31.233), 11);
}

function loadScript() {
var script = document.createElement("script");
script.src = "http://api.map.baidu.com/api?v=2.0&ak=您的密钥&callback=initialize";//此为v2.0版本的引用方式
// http://api.map.baidu.com/api?v=1.4&ak=您的密钥&callback=initialize"; //此为v1.4版本及以前版本的引用方式
document.body.appendChild(script);
}

window.onload = loadScript;
</script>
</head>
<body>
<div id="map" style="width:500px;height:320px"></div>
</body>
</html>
转自:http://lbsyun.baidu.com/index.php?title=jspopular/guide/introduction

js 地图功能

标签:utf-8   ini   tle   doctype   src   head   append   poi   llb   

原文地址:http://www.cnblogs.com/wenhuan/p/6228556.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!