JavaScript Code復(fù)制內(nèi)容到剪貼板
- <script type="text/javascript" src="jquery.js"></script>
-
- jQuery(function() {
-
-
-
- if(navigator.geolocation) {
-
-
-
- navigator.geolocation.getCurrentPosition(function(position) {
-
-
-
- var jsonUrl = "https://maps.googleapis.com/maps/api/geocode/json?latlng="+position.coords.latitude+","+position.coords.longitude
-
- jQuery.getJSON(jsonUrl , function( data ) {
-
- var results = data.results[0];
-
- console.info(results);
-
- alert(results.address_components[5].long_name);
-
- alert(results.address_components[6].long_name);
-
- alert(results.address_components[7].long_name);
-
- },
-
- function(){
-
- alert('Failed to get Location Details...');
-
- });
-
- return false;
-
-
-
- });
-
- }});