GeoLocation HTML5返回position.coords getCurrentLocation的范围

时间:2011-07-15 23:28:49

标签: html5 geolocation

我搜索返回函数navigator.geolocation.getCurrentLocation(getLocation,err)范围之外的position.coords。我尝试过使用窗口变量,但我不能,所有值都是本地人。有人可以指出方向。感谢

1 个答案:

答案 0 :(得分:-1)

我认为你的意思是getCurrentPosition。如果您只需要坐标,则可以执行此操作。

return coords.clone();

<强>更新

getCurrentPosition需要回调函数。您可以使用以下内容:

navigator.geolocation.getCurrentPosition(function(pos) {
    alert(pos.coords.latitude+","+pos.coords.longitude);
});