bonsoir,

Je voudrais faire faire apparaître les latitudes et longitudes dans les champs du formulaire puis en cliquant sur geolocate Ecrire ces données dans un fichier txt

Ceci dit je n y arrive pas .... donc je demande votre aide si vous le voulez bien
je vous laisse le code que j 'ai. Merci d'avance


Code : Sélectionner tout - Visualiser dans une fenêtre à part
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
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
 
 
</head>
 
 
<body alink="#000000" bgcolor="#ffffff" link="#000000" text="#000000" vlink="#000000">
 
<table align="center" border="1" cellpadding="2" cellspacing="2" height="585" width="500">
 
  <tbody>
 
    <tr>
 
      <td valign="top">
      <div align="center"><big><big><big><big><b>MobileStorm<br>
 
<?php include("alarme.php");?></b></big></big></big></big><br>
 
      <hr size="2" width="100%">
      <div align="left">
      <script type="text/javascript">function startWatch(){
if (navigator.geolocation)
var watchId = navigator.geolocation.watchPosition(successCallback,
errorCallback,
{enableHighAccuracy:true,
timeout:10000,
maximumAge:0});
else
alert("Votre navigateur ne prend pas en compte la géolocalisation HTML5");
}
function stopWatch(){
navigator.geolocation.clearWatch(watchId);
} function successCallback(position){
document.getElementById("lat").innerHTML = position.coords.latitude;
document.getElementById("long").innerHTML = position.coords.longitude;
document.getElementById("prec").innerHTML = position.coords.accuracy;
document.getElementById("alt").innerHTML = position.coords.altitude;
document.getElementById("precalt").innerHTML = position.coords.altitudeAccuracy;
document.getElementById("angle").innerHTML = position.coords.heading;
document.getElementById("speed").innerHTML = position.coords.speed;
document.getElementById("time").innerHTML = new Date(position.timestamp);
}; function errorCallback(error){
switch(error.code){
case error.PERMISSION_DENIED:
alert("L'utilisateur n'a pas autorisé l'accès à sa position");
break; case error.POSITION_UNAVAILABLE:
alert("L'emplacement de l'utilisateur n'a pas pu être déterminé");
break;
case error.TIMEOUT:
alert("Le service n'a pas répondu à temps");
break;
}
};
      </script>
      <ul>
 
        <li>Latitude : <span id="lat"></span></li>
 
        <li>Longitude : <span id="long"></span></li
 
 
 
 
 
      </ul>
 
      <div align="center"><a href="#" onclick="startWatch()"><big><b>[ DEMARRER ]</b></big></a>
      <a href="#" onclick="stopWatch()"><big><b>[
ARR&Ecirc;TER ]</b></big></a><br>
      </div>
 
      <div align="left"> 
      <hr size="2" width="100%"></div>
 
 
 
       <form id="latitude"><input id="lat" value="lat"type="text">
 
       <form id="longitude"><input id="long" value="long"type="text">
 
       <input value="Geolocate" type="submit"></form>
 
 
 
 
 
 
 
 
 
 
 
 
      </div>