Guest User

Untitled

a guest
Jul 16th, 2018
85
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.64 KB | None | 0 0
  1. <script type="text/javascript">
  2.  
  3. function displayLocation(position) {
  4. latitude = position.coords.latitude;
  5. longitude = position.coords.longitude;
  6. accuracy = position.coords.accuracy;
  7. speed = position.coords.speed;
  8. document.getElementById("locationInfoId").childNodes[0].nodeValue = "Long: " + longitude.toFixed(5) + " Lat: " + latitude.toFixed(5) + " Acc: " + accuracy.toFixed(0);
  9. }
  10.  
  11. var watchId = 0;
  12. function getLocation() {
  13. navigator.geolocation.getCurrentPosition(displayLocation, handleError, {maximumAge:600000, timeout:0, enableHighAccuracy:true});
  14. }
  15.  
  16. </script>
Add Comment
Please, Sign In to add comment