【发布时间】:2013-04-23 15:11:08
【问题描述】:
// This method accepts a `Position` object, which contains
// the current GPS coordinates
function onSuccess(position) {
var element = document.getElementById('geolocation');
element.innerHTML = 'Latitude: ' + position.coords.latitude + '<br />' +
'Longitude: ' + position.coords.longitude + '<br />' +
'Altitude: ' + position.coords.altitude + '<br />' +
'Accuracy: ' + position.coords.accuracy + '<br />' +
'Altitude Accuracy: ' + position.coords.altitudeAccuracy + '<br />' +
'Heading: ' + position.coords.heading + '<br />' +
'Speed: ' + position.coords.speed + '<br />' +
'Timestamp: ' + position.timestamp + '<br />';
}
这是从 phonegap 自己的网站上获取的关于 geoLocation 的示例,但有一些问题我不能安静地理解,我们使用位置变量对象来访问坐标的成员,如纬度,经度但是我们如何在 js 中创建位置对象,即使有不是变量类型。
【问题讨论】:
标签: javascript android html cordova geolocation