当我尝试更改位置时,我遇到了一个小问题。我已连接到地图
var mapOptions = {
zoom: 7,
center: new google.maps.LatLng(48.379433, 31.165579999999977),
mapTypeControl: false,
mapTypeId: google.maps.MapTypeId.ROADMAP
}
map = new google.maps.Map(document.getElementById("map_canvas"), mapOptions);
现在我需要更改地图上的位置
<select onChange="changeCity()" id="city"><option value="50.4501, 30.523400000000038">Київ</option><option value="49.839683, 24.029717000000005">Львів</option></select>
为此,我正在使用:
function changeCity() {
var city = document.getElementById('city').value;
var city_1 = new google.maps.LatLng(city);
map.setCenter(city_1);
}
但什么也没发生(我看到灰色区域)。请帮忙...!