我想在单击时调用此功能,但它不能用于单击。单击不起作用
<input id="search" type="button" onClick="codeAddress();" value="Search Location" />
function codeAddress() {
geocoder = new google.maps.Geocoder();
var address = document.getElementById("box").value;
geocoder.geocode({ 'address': address}, function(results, status) {
if (status == google.maps.GeocoderStatus.OK) {
a = results[0].geometry.location.lat();
b = results[0].geometry.location.lng();
myLatlng = new google.maps.LatLng(a, b);
}
else {
alert("Geocode was not successful for the following reason: " + status);
}
});
initialize();
}
“它不工作”,这是一个错误,我总是在这个网站 – madalinivascu
你是否包括谷歌地图JavaScript API V3获得最详细的说明?请提供证明问题的[mcve]。 – geocodezip