Created
April 30, 2017 17:45
-
-
Save anonymous/5008dd70af11f4c1764f9d2d4be88324 to your computer and use it in GitHub Desktop.
Geolocalización // adjuntamos: https://github.com/mglriosr/Wreckec
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function iniciar(){ | |
var boton=document.getElementById('obtener'); | |
boton.addEventListener('click', obtener, false); | |
} | |
function obtener(){navigator.geolocation.getCurrentPosition(mostrar, gestionarErrores);} | |
function mostrar(posicion){ | |
var ubicacion=document.getElementById('localizacion'); | |
var datos=''; | |
datos+='Latitud: '+posicion.coords.latitude+'<br>'; | |
datos+='Longitud: '+posicion.coords.longitude+'<br>'; | |
datos+='Exactitud: '+posicion.coords.accuracy+' metros.<br>'; | |
ubicacion.innerHTML=datos; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment