Dynamic Blinkie Text Generator at TextSpace.net

Feedburner

I heart FeedBurner

Minggu, 31 Januari 2016

<!DOCTYPE html>
<html>
<head>
<meta charset=utf-8 />
<title>JS Bin</title>
</head>
<body>
  
  <input type="text" id="latitude" placeholder="latitude">
  <input type="text" id="longitude" placeholder="longitude">
  <div id="map" style="width:500px; height:500px"></div>
  
  <script src="https://maps.googleapis.com/maps/api/js?v=3.exp&sensor=false"></script>
  <script>
  function initialize() {
    var $latitude = document.getElementById('latitude');
    var $longitude = document.getElementById('longitude');
    var latitude = 50.715591133433854
    var longitude = -3.53485107421875;
    var zoom = 7;
    
    var LatLng = new google.maps.LatLng(latitude, longitude);
    
    var mapOptions = {
      zoom: zoom,
      center: LatLng,
      panControl: false,
      zoomControl: false,
      scaleControl: true,
      mapTypeId: google.maps.MapTypeId.ROADMAP
    }  
    
    var map = new google.maps.Map(document.getElementById('map'),mapOptions);
    
    var marker = new google.maps.Marker({
      position: LatLng,
      map: map,
      title: 'Drag Me!',
      draggable: true
    });
    
    google.maps.event.addListener(marker, 'dragend', function(marker){
      var latLng = marker.latLng;
      $latitude.value = latLng.lat();
      $longitude.value = latLng.lng();
    });
    
  }
  initialize();
  </script>
  
</body>
</html>
Example Source Code :
<!DOCTYPE html>
<html>
<head>
<meta charset=utf-8 />
<title>JS Bin</title>
</head>
<body>
  
  <input type="text" id="latitude" placeholder="latitude">
  <input type="text" id="longitude" placeholder="longitude">
  <div id="map" style="width:500px; height:500px"></div>
  
  <script src="https://maps.googleapis.com/maps/api/js?v=3.exp&sensor=false"></script>
  <script>
 function initialize() {
  var $latitude = document.getElementById('latitude');
  var $longitude = document.getElementById('longitude');
  var latitude = 50.715591133433854
  var longitude = -3.53485107421875;
  var zoom = 7;
  
  var LatLng = new google.maps.LatLng(latitude, longitude);
  
  var mapOptions = {
   zoom: zoom,
   center: LatLng,
   panControl: false,
   zoomControl: false,
   scaleControl: true,
   mapTypeId: google.maps.MapTypeId.ROADMAP
  } 
  
  var map = new google.maps.Map(document.getElementById('map'),mapOptions);
      
  
  var marker = new google.maps.Marker({
   position: LatLng,
   map: map,
   title: 'Drag Me!',
   draggable: true
  });
  
  google.maps.event.addListener(marker, 'dragend', function(marker){
   var latLng = marker.latLng;
   $latitude.value = latLng.lat();
   $longitude.value = latLng.lng();
  });
  
  
 }
 initialize();
 </script>
  
</body>
</html>
Source :
http://www.aliaspooryorik.com/blog/index.cfm/e/posts.details/post/using-drag-and-drop-to-get-latitude-and-longitude-392 

Tidak ada komentar:

Posting Komentar