Wrox Programmer Forums
Go Back   Wrox Programmer Forums > Web Programming > JavaScript > Javascript How-To
|
Javascript How-To Ask your "How do I do this with Javascript?" questions here.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Javascript How-To section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old January 27th, 2016, 10:05 AM
Authorized User
 
Join Date: Apr 2007
Posts: 92
Thanks: 0
Thanked 0 Times in 0 Posts
Default 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!





Similar Threads
Thread Thread Starter Forum Replies Last Post
Move form from table field into variable to run form AnninCT BOOK: Access 2007 VBA Programmer's Reference ISBN: 978-0-470-04703-3 0 April 17th, 2010 11:17 AM
help with passing a variable from a form field via url Igor Astakhov BOOK: Beginning PHP 6, Apache, MySQL 6 Web Development ISBN: 9780470391143 2 March 10th, 2009 02:00 PM
Select a field on a form, based on variable JAnthony Access VBA 2 April 17th, 2006 11:16 AM
capture variable in URL Lemonluv07 BOOK: Beginning ASP.NET 2.0 BOOK VB ISBN: 978-0-7645-8850-1; C# ISBN: 978-0-470-04258-8 1 March 31st, 2006 04:00 AM
capture a variable from url. .com?jblp jblp PHP How-To 1 October 25th, 2004 07:26 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.