0
我想要一个JavaScript链接,它将从我的地图中删除路线。删除路线不工作
别处在这个论坛 Remove directions from google map api v3有人问过类似的问题,有一个解决方案 - 但解决方案并不为我工作。 基于此我试过:
function clearDirections() {
directionDisplay = new google.maps.DirectionsRenderer();
directionDisplay.suppressMarkers = true;
directionDisplay.setMap(null);
return false;
}
我在做什么错了?
对不起,但我不知道如何做到这一点。我的地图基于Google的示例:http://code.google.com/apis/maps/documentation/javascript/examples/directions-complex.html – webewitch 2012-03-13 16:52:56
如果您提供地图链接,也许有人可以帮助您。在这个例子中,directionDisplay已经是一个全局变量,尽管存在拼写错误,因为它稍后使用directionsDisplay。 – barryhunter 2012-03-13 17:22:07
太棒了! 我模仿了错字。 我把它改成了传统的方向显示,然后这个函数做了诀窍: 'function clearDirections(){ document.getElementById(“directionsPanel”)。innerHTML =“”; directionDisplay.setMap(null); 返回false; }' 谢谢! – webewitch 2012-03-13 18:25:28