- <!DOCTYPE html>
- <html>
- <head>
- <script type="text/javascript">
- function initGeolocation()
- {
- if( navigator.geolocation )
- {
- // Call getCurrentPosition with success and failure callbacks
- navigator.geolocation.getCurrentPosition( success, fail );
- }
- else
- {
- alert("Sorry, your browser does not support geolocation services.");
- }
- }
- function success(position)
- {
- document.getElementById('long').value = position.coords.longitude;
- document.getElementById('lat').value = position.coords.latitude
- }
- function fail()
- {
- // Could not obtain location
- }
- </script>
- </head>
- <body onLoad="initGeolocation();">
- <FORM NAME="rd" METHOD="POST" ACTION="index.html">
- <INPUT TYPE="text" NAME="long" ID="long" VALUE="">
- <INPUT TYPE="text" NAME="lat" ID="lat" VALUE="">
- </body>
- </html>
get your location and save in Mysql
https://forums.digitalpoint.com/threads/how-to-get-longitude-and-latitude-to-my-page-using-html5.1965305/
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment