Location of the Geographic Information Application:
[Javascript]
Function $ (id) {return document. getElementById (id );}
Window. onload = function (){
If (navigator. geolocation ){
Navigator. geolocation. getCurrentPosition (
Function (pos ){
$ ("Lat"). innerHTML = pos. coords. latitude; // latitude
$ ("Lon"). innerHTML = pos. coords. longpolling; // longitude
$ ("Alt"). innerHTML = pos. coords. altitude; // height
$ ("Accuracy"). innerHTML = pos. coords. accuracy;
$ ("AltitudeAccuracy"). innerHTML = pos. coords. altitudeAccuracy;
$ ("Heading"). innerHTML = pos. coords. heading;
$ ("Speed"). innerHTML = pos. coords. speed;
$ ("Timestamp"). innerHTML = pos. timestamp;
// $ ("Status"). innerHTML = JSON. stringify (pos );
},
Function () {}, www.2cto.com
{EnableHighAccuracy: true, maximumAge: 600000}
);
} Else {
$ ("Status"). innerHTML =
'No Geolocation support for your Browser ';
}
}
Author: shiyuan17