Javascript 使用地点的地址查找坐标

Javascript 使用地点的地址查找坐标,javascript,google-maps,Javascript,Google Maps,我有一个地址列表(街道、城市、国家、邮政编码),我想找到lat和long来在谷歌地图上标记它们。 有可能吗?我想这就是你想要的。是的,谢谢 这就是我要找的 function codeAddress() { var address = document.getElementById("address").value; geocoder.geocode( { 'address': address}, function(results, status) { if (status == google

我有一个地址列表(街道、城市、国家、邮政编码),我想找到lat和long来在谷歌地图上标记它们。 有可能吗?

我想这就是你想要的。

是的,谢谢
这就是我要找的

function codeAddress() {
var address = document.getElementById("address").value;
geocoder.geocode( { 'address': address}, function(results, status) {
  if (status == google.maps.GeocoderStatus.OK) {
    map.setCenter(results[0].geometry.location);
    var marker = new google.maps.Marker({
        map: map,
        position: results[0].geometry.location
    });
  } else {
    alert("Geocode was not successful for the following reason: " + status);
  }
});
}