<html>
<head>
<title>Geolocation API地理定位</title>
<script type="text/javascript">
navigator.geolocation.getCurrentPostion(function(pos) {
console.log("当前地理位置的纬度:" + pos.coords.laitude);
console.log("当前地理位置的经度:" + pos.coords.longitude);
console.log("当前经纬度的经度:" + pos.coords.accuracy);
});
var watchID = navigator.geolocation.witchPosition(function(pos) {
console.log("当前位置变化的纬度:" + pos.coords.laitude);
console.log("当前位置变化的经度:" + pos.coords.longitude);
console.log("当前位置变化的经度:" + pos.coords.accuracy);
navigator.geolocation.clearwatch(watchID);
}, function() { });
</script>
</head>
<body>
</body>
</html>
时间: 2024-10-05 08:21:52