利用百度开发者中心的api实现地图及周边的搜索
生活随笔
收集整理的這篇文章主要介紹了
利用百度开发者中心的api实现地图及周边的搜索
小編覺得挺不錯的,現在分享給大家,幫大家做個參考.
<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{ 100%;height: 100%; margin:0;font-family:"微軟雅黑";}
#l-map{height:300px;100%;}
#r-result{100%;height:100%;}
</style>
<script type="text/javascript" src="http://api.map.baidu.com/api?v=2.0&ak=lEr9VcIQCFEkpCWyAsEY6VCdWeFj8A12"></script>
<title>服務導引</title>
</head>
<body>
<div id="l-map"></div>
<div id="r-result"></div>
</body>
</html>
<script type="text/javascript">
// 百度地圖API功能
var map = new BMap.Map("l-map"); // 創建Map實例
map.centerAndZoom(new BMap.Point(118.059023,36.811819), 11);
var local = new BMap.LocalSearch(map, {
renderOptions:{map:map,panel:"r-result"}
});
local.search("淄博華光路188號玉龍大廈B座");
</script>
總結
以上是生活随笔為你收集整理的利用百度开发者中心的api实现地图及周边的搜索的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: 找宝箱
- 下一篇: ajax 12301 原因小结