<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title></title>
</head>
<body>
<script>
window.addEventListener('load', function () {
if (navigator.geolocation) {
navigator.geolocation.watchPosition(updata);
}
}, false);
function updata(position) {
var lat = position.coords.latitude;
var lng = position.coords.longitude;
document.write('维度:' + lat + ',经度:' + lng);
}
</script>
</body>
</html>