我试图通过更改组合菜单的值来更改圆半径。所以我为 onchange 编写了一个函数,如下所示。
function changeRadius(){
var selectedRadius = (document.getElementById("circle_radius").value)*1000;
var circle = new google.maps.Circle({
map: map,
radius: selectedRadius // radius unit is meter.
});
var marker2 = new google.maps.Marker({
map: map,
position: new google.maps.LatLng(40,-90),
draggable: true,
title: 'Drag me!'
});
circle1.bindTo('center', marker2, 'position');
}
Run Code Online (Sandbox Code Playgroud)
但这不起作用。任何想法?