<!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
时间: 2024-10-29 03:09:23