Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // var x = document.getElementById("demo");
- function getLocation() {
- if (navigator.geolocation) {
- navigator.geolocation.getCurrentPosition(showPosition);
- } else {
- x.innerHTML = "Geolocation is not supported by this browser.";
- }
- }
- function showPosition(position) {
- var longitude = position.coords.longitude;
- document.getElementById('id_longitude').value = longitude;
- latitude = position.coords.latitude;
- document.getElementById('id_latitude').value = latitude;
- }
Add Comment
Please, Sign In to add comment