Looking for help with a quick JS project.
I need this (or similar) code to pull the GPS info from a mobile browser and
update two hidden form fields with the GPS coordinates. If the function could
loop and continue to watchPosition() and update the form without interrupting
the end user's attempt to fill out the rest ofthe form, that would be awesome.
Will pay via paypal, unless this is so stupidly simple that you're willing to
justpost the solution here. I need working by Monday morning. Call (413)
320-5336 to coordinate, or just reply here.
This is in the HEAD tag:
<script type="text/javascript">
function getLocationConstant()
{
if(navigator.geolocation)
{
navigator.geolocation.getCurrentPosition(onGeoSuccess,onGeoError);
} else {
alert("Your browser or device doesn't support Geolocation");
}
}
// If we have a successful location update
function onGeoSuccess(event)
{
document.getElementById("Latitude").value = event.coords.latitude;
document.getElementById("Longitude").value = event.coords.longitude;
}
// If something has gone wrong with the geolocation request
function onGeoError(event)
{
alert("Error code " + event.code + ". " + event.message);
}
</script>
This is in the FORM:
<img src="spacer.gif" OnLoad="getLocationConstant()">
<input type="Hidden" name="Latitude" id="Latitude" value="">
<input type="Hidden" name="Longitude" id="Longitude" value="">
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Order the Adobe Coldfusion Anthology now!
http://www.amazon.com/Adobe-Coldfusion-Anthology/dp/1430272155/?tag=houseoffusion
Archive:
http://www.houseoffusion.com/groups/javascript/message.cfm/messageid:6877
Subscription: http://www.houseoffusion.com/groups/javascript/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/groups/javascript/unsubscribe.cfm