-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathscript.js
60 lines (52 loc) · 1.59 KB
/
script.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
function getLocation()
{
if (navigator.geolocation)
{
navigator.geolocation.getCurrentPosition(showPosition,showError);
}
else{alert("Seu browser não suporta Geolocalização.");}
}
function showPosition(position)
{
var lt = position.coords.latitude;
var lg = position.coords.longitude;
document.getElementById("lg").value = lg;
document.getElementById("lt").value = lt;
}
function showError(error)
{
switch(error.code)
{
case error.PERMISSION_DENIED:
alert("Usuário rejeitou a solicitação de Geolocalização.")
break;
case error.POSITION_UNAVAILABLE:
alert("Localização indisponível.")
break;
case error.TIMEOUT:
alert("A requisição expirou.")
break;
case error.UNKNOWN_ERROR:
alert("Algum erro desconhecido aconteceu.")
break;
}
}
function send(){
var fname = document.getElementById("fname").value;
var telephone = document.getElementById("telephone").value;
var email = document.getElementById("email").value;
var country = document.getElementById("country").value;
var state = document.getElementById("state").value;
var bdate = document.getElementById("bdate").value;
var lt = document.getElementById("lt").value;
var lg = document.getElementById("lg").value;
alert("Dados Enviados: " +
"\nFull Name: " + fname +
"\nTelephone: " + telephone +
"\nE-mail: " + email +
"\nCountry: " + country +
"\nState: " + state +
"\nBirth date: " + bdate +
"\nLatitude: " + lt +
"\nLongitude: " + lg);
}