I have read the same problem here many times and have fixed the most repetitive solutions and error handlers such as w3c specification I do not give any exception or error and there is no result. I do not know what should I do?
This is the complete code I have written!
& lt ;! DOCTYPE HTML & gt; & Lt; Html & gt; & Lt; Top & gt; & Lt; Title & gt; HTML5 Egyptian User Group - Demos & lt; / Title & gt; & Lt; Script src = "http://maps.google.com/maps/api/js?sensor=false" & gt; & Lt; / Script & gt; & Lt; Script type = "text / javascript" & gt; Var lastLat; Var last time; Function update status (message) {document.getElementById ("status"). InnerHTML = message; } Function loadDemo () {if (navigator.clocation) {updateStatus ("W3C geolocation is supported in your browser."); Navigator.geolocation.watchPosition (Update Location, Helmocolitimation, {Max Edge: 20000}); }} Window.addEventListener ("load", loadDemo, true); Function handling arrow (error) {switch (error code) {case 0: updateStatus ("There was an error while retrieving your location:" + error message); break; Case 1: Update status ("The user stopped this page from getting the position."); break; Case 2: UpdateStatus ("The browser was unable to determine your location:" + error message); break; Case 3: UpdateStatus ("The time has passed before getting the position of the browser."); break; }} Function Update Location (status) {var Latitude = Status. Calls. Lettuce; Var longitude = position.coords.longitude; Var Accuracy = position.coords.accuracy; Var timestamp = position.timestamp; Document.getElementById ("Latitude"). InnerHTML = Latitude; Document.getElementById ("Longitude"). InnerHTML = longitude; Document.getElementById ("Accuracy"). InnerHTML = Accuracy; Document.getElementById ("Timestamp"). InnerHTML = Timestamp; // Sanit Test ... if the accuracy / value is too much if the accuracy (accuracy> = 500) {updateStatus ("a more accurate value is required to calculate the distance.") Do not calculate the distance; Return; }} & Lt; / Script & gt; & Lt; / Head & gt; & Lt; Body & gt; & Lt; Button onclick = "loadDemo ()" & gt; LoadDemo () & lt; / Button & gt; & Lt; Input type = "text" value = "latitude here" id = "latitude" /> & Lt; Input type = "text" value = "latitude here" id = "latitude" /> & Lt; Input type = "text" value = "accuracy here" id = "accuracy" /> & Lt; Input type = "text" value = "timestamp here" id = "timestamp" /> & Lt; Input type = "text" value = "status here" id = "status" /> & Lt; Period & gt; Mustafa Adel & lt; Span & gt; & Lt; / Body & gt; & Lt; / Html & gt;
You are using input controls to set the value instead of internal HTML try.
function update location (status) {var latitude = status.cords.latidad; Var longitude = position.coords.longitude; Var Accuracy = position.coords.accuracy; Var timestamp = position.timestamp; Document.getElementById ("Latitude"). Value = latitude; Document.getElementById ("Longitude"). Value = longitude; Document.getElementById ("Accuracy"). Value = accuracy; Document.getElementById ("Timestamp"). Value = timestamp; // Sanit Test ... if the accuracy / value is too much if the accuracy (accuracy> = 500) {updateStatus ("a more accurate value is required to calculate the distance.") Do not calculate the distance;) ; Return; }}
Comments
Post a Comment