1

如何在用户单击提交按钮时在两点之间绘制一条折线,并在用户单击重置按钮时将其重置。我用这段代码在绘图函数()中绘制了一条折线,并使用 onclick()调用了它,但这不起作用,请任何人告诉我我们如何调用该函数并绘制一条折线

<script>
function initialize()
{
....}

    function plotting()
     {
       var stratapps = [
            new google.maps.LatLng(17.447246,78.362029),
            new google.maps.LatLng(37.50905,-121.974659),

        ];
        var flightPath = new google.maps.Polyline({
          path: stratapps,
          strokeColor: "#FF0000",
          strokeOpacity: 1.0,
          strokeWeight: 2,

        }); 
             flightPath.setMap(map); 
       }  google.maps.event.addDomListener(window, 'load', plotting);

    <button value="plot" onclick="plotting();">Plot</button>
4

0 回答 0