capture variable in a form field
Hi.
I need to get the results of the latitude and longitude to appear in the form field as well.
cant figure it out!
code:
<html>
<head>
<script>
function showlocation() {
// One-shot position request.
navigator.geolocation.getCurrentPosition(callback) ;
}
function callback(position) {
document.getElementById('latitude').innerHTML = position.coords.latitude;
document.getElementById('longitude').innerHTML = position.coords.longitude;
}
</script>
</head>
<body onload="javascript:showlocation()" >
Latitude: <span id="latitude"></span> <br/>
Longitude: <span id="longitude"></span>
<%=test%>
<form>
<input type="text" name="latitude" id="lattitude" value=""/>
<input type="text" name="longitude" id="longitude" value=""/>
</form>
</body>
</html>
THANX!
|