调用百度地图。点击查看路线,由指定起始点。问题 把那个设置时间的去掉试试或者。直接参考 百度api示例源码http://developer.baidu.com/map/jsdemo.htm#i4_1 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 这个设置时间的是反应速度。比如我输入 比较详细的街道信息。天目山路1号到天目山路181号。地图上就没有显示了。时间去掉也是这个效果。~~~~(>_<)~~~~ Quote: 引用 2 楼 huanglin02 的回复:时间去掉也是这个效果。~~/quote] 那你去看官方api示例吧。 界面上点击查看,把起始点传入 那个界面。<a href="javascript:void(0);" onclick="doLocation('<s:property value="START"/>','<s:property value="FINISH"/>');"></a>function doLocation(START,FINISH) { window.document.getElementById("roadmap").src="${pageContext.request.contextPath}/netinfo/Hispaths.do?START="+START+"&FINISH="+FINISH; }去后台 就是 把传入的参数设置了一下不让其乱码。传入到 地图上界面获取 起始点。然后就是 地图界面<html> <head> <meta http-equiv="Content-Type" content="text/html;charset=utf-8" /> <style type="text/css">body,html,#allmap { width: 100%; height: 100%; overflow: hidden; margin: 0;}#l-map { height: 100%; width: 78%; float: left; border-right: 2px solid #bcbcbc;}#r-result { height: 100%; width: 20%; float: left;}</style> <script type="text/javascript" src="http://api.map.baidu.com/api?v=1.5&ak=密钥"></script> <title>HAKIM</title> </head> <s:hidden name="START" id="START"></s:hidden> <s:hidden name="FINISH" id="FINISH"></s:hidden> <div id="allmap"></div> <script type="text/javascript"> var fromWhere = document.getElementById("START").value; var toWhere = document.getElementById("FINISH").value; var map = new BMap.Map("allmap"); //setTimeout("seachNavigate()",0); //function seachNavigate() { var driving = new BMap.DrivingRoute(map, { renderOptions : { map : map, autoViewport : true } }); driving.search(fromWhere, toWhere); //} </script></html> <!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; } </style> <script type="text/javascript" src="http://api.map.baidu.com/api?v=2.0&ak=D4a8d74ef14707ec0e0ee5ea88ba0570"></script> <title>根据起终点名称查询公交换乘</title></head><body> <div id="allmap"></div></body></html><script type="text/javascript"> // 百度地图API功能 var map = new BMap.Map("allmap"); // 创建Map实例 map.centerAndZoom(new BMap.Point(120.16, 30.29), 14); var transit = new BMap.TransitRoute(map, { renderOptions: { map: map } }); transit.search("天际大厦", "龙都大厦");</script>这样我试了一下。除了天目1到181不显示。其他都可以,我觉得你设置下map.centerAndZoom(new BMap.Point(120.16, 30.29), 14);这个精确度会更好点。 一个关于jquery绑定时间的问题 多级导航菜单中奇怪的样式问题 JS更换body内容 问个比较基础的问题 用js实现对多个div的z-index的调整 Jquery ui scroll draggable 鼠标错位问题 怎么在javascript中把当前页面保存成mht文件 window.open什么情况下会失败? 如何指定form下的单元格及控件? jquery.infinitescroll怎么改成点击加载呢 一个jquery里面的正则表达式没太看明白 请教一个自定义jquery函数的用法
界面上点击查看,把起始点传入 那个界面。<a href="javascript:void(0);" onclick="doLocation('<s:property value="START"/>','<s:property value="FINISH"/>');"></a>
function doLocation(START,FINISH)
{
window.document.getElementById("roadmap").src="${pageContext.request.contextPath}/netinfo/Hispaths.do?START="+START+"&FINISH="+FINISH;
}
去后台 就是 把传入的参数设置了一下不让其乱码。传入到 地图上界面获取 起始点。然后就是 地图界面<html>
<head>
<meta http-equiv="Content-Type" content="text/html;charset=utf-8" />
<style type="text/css">
body,html,#allmap {
width: 100%;
height: 100%;
overflow: hidden;
margin: 0;
}#l-map {
height: 100%;
width: 78%;
float: left;
border-right: 2px solid #bcbcbc;
}#r-result {
height: 100%;
width: 20%;
float: left;
}
</style>
<script type="text/javascript" src="http://api.map.baidu.com/api?v=1.5&ak=密钥"></script>
<title>HAKIM</title>
</head> <s:hidden name="START" id="START"></s:hidden>
<s:hidden name="FINISH" id="FINISH"></s:hidden>
<div id="allmap"></div> <script type="text/javascript">
var fromWhere = document.getElementById("START").value;
var toWhere = document.getElementById("FINISH").value;
var map = new BMap.Map("allmap");
//setTimeout("seachNavigate()",0);
//function seachNavigate() { var driving = new BMap.DrivingRoute(map, {
renderOptions : {
map : map,
autoViewport : true
}
}); driving.search(fromWhere, toWhere);
//}
</script></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;
}
</style>
<script type="text/javascript" src="http://api.map.baidu.com/api?v=2.0&ak=D4a8d74ef14707ec0e0ee5ea88ba0570"></script>
<title>根据起终点名称查询公交换乘</title>
</head>
<body>
<div id="allmap"></div>
</body>
</html>
<script type="text/javascript"> // 百度地图API功能
var map = new BMap.Map("allmap");
// 创建Map实例
map.centerAndZoom(new BMap.Point(120.16, 30.29), 14);
var transit = new BMap.TransitRoute(map, {
renderOptions: { map: map }
});
transit.search("天际大厦", "龙都大厦");
</script>这样我试了一下。除了天目1到181不显示。其他都可以,我觉得你设置下
map.centerAndZoom(new BMap.Point(120.16, 30.29), 14);这个精确度会更好点。