我是第一次使用 javascript。实际上我想使用 java 脚本获取地址的纬度和经度。谁能指导我..
最佳答案
如果你需要给定地址的经纬度,你可以使用google maps api https://developers.google.com/maps/documentation/javascript/
举个例子: https://google-developers.appspot.com/maps/documentation/javascript/examples/geocoding-simple
编辑:在警报弹出窗口中显示它:
var address = document.getElementById("address").value;
var geocoder = new google.maps.Geocoder();
geocoder.geocode( { 'address': address}, function(results, status) {
var location = results[0].geometry.location;
alert(location.lat() + '' + location.lng());
});
关于javascript - 使用javascript查找经纬度,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/11033451/