Tuesday, 5 April 2016

Trace Location by longitude and latitude in HTML using google API..!!


<!DOCTYPE html>
<html>
   
   <head>
      <script src = "http://maps.googleapis.com/maps/api/js"></script>
      
      <script>
         function loadMap(longi,lati) {
   
            var mapOptions = {
               center:new google.maps.LatLng(longi,lati),
               zoom:7
            }
    
  var map = new google.maps.Map(document.getElementById("sample"),mapOptions);
            
            var marker = new google.maps.Marker({
               position: new google.maps.LatLng(longi,lati),
               map: map,
            });
         }
      </script>
      
   </head>
   
   <body >
   <form onsubmit="return false;">
   <input type="text" placeholder="longitude" id="longi">
   <input type="text" placeholder="latitude" id="lati">
   <input type="button" onclick="loadMap(document.getElementById('longi').value,
     document.getElementById('lati').value)" value="TracertLocation"> 
   </form>
      <div id = "sample" style = "width:580px; height:400px;"></div>
   </body>
   
</html>


It will Work as..!!!!


   
   
      
      
      
      
   
   
   
   

No comments:

Post a Comment