【发布时间】:2011-07-16 15:38:25
【问题描述】:
如何为 getCurrentLocation 方法添加回调函数,将坐标或位置作为参数传递给全局变量?该对象允许将坐标传递给 getCurrentLocation 之外的全局变量。
//Global scope
var Location= {coords:null;
}
function getLocation(position)
{
position.coords.latitude;
Location.coords=coords.clone();
}
somewhere
navigator.geolocation.getCurrentLocation(getLocation, error)
Location.coords is NULL !
谢谢。
【问题讨论】:
标签: html geolocation