I have this code that shows the current location as being specified in the “LatLng” coordinates. But what I want is have have an input boxes, lets say 2 input boxes “location from” and “location to.” I wish to show the current location of the given input values from the 2 boxes as being indicated.
Is that possible in Google Map V3?
I want to have the mapOptions values will be the values inputs in the boxes.
How to do that?
Here is my code.
<!DOCTYPE html>
<html>
<head>
<meta name="viewport" content="initial-scale=1.0, user-scalable=no" />
<style type="text/css">
html { height: 100% }
body { height: 100%; margin: 0; padding: 0 }
#map_canvas { height: 100% }
</style>
<script type="text/javascript"
src="http://maps.googleapis.com/maps/api/js?key=AIzaSyBQ8OCC8En5vNHod25Ov3Qs5E1v7NPRSsg&sensor=true">
</script>
<script type="text/javascript">
function initialize() {
// add mapOptions here to the values in the input boxes.
var mapOptions = {
center: new google.maps.LatLng(-34.397, 100.644),
zoom: 2,
mapTypeId: google.maps.MapTypeId.ROADMAP
};
var map = new google.maps.Map(document.getElementById("map_canvas"),
mapOptions);
}
</script>
</head>
<body>
From: <input type="text" name="From"><br>
To: <input type="text" name="To"><br>
<button type="button" onclick="initialize()">View example (map-simple.html)</button>
<div id="map_canvas" style="width:100%; height:100%"></div>
</body>
</html>
Thanks
Jason
you should use
geocoderfor thatMap Fiddle