Home > Asp.net > How to add pin on page load and move it anywhere on Google map using JavaScript

How to add pin on page load and move it anywhere on Google map using JavaScript

This post was most recently updated on August 5th, 2024

Demo: PinOnMap

Here is the source code to show pin on Google map using JavaScript:

<script type=”text/javascript” src=”http://maps.google.com/maps/api/js?sensor=false”></script>
<script type=”text/javascript”>

</script>

// html code

<body onload=”initialize(new google.maps.LatLng(18.5203,73.8567))” style=”font-family: Arial; border: 0 none;”>
<input type=”text” size=”52″ name=”address” id=”Address” />
<input type=”button” onclick=”showAddress();” value=”Search on map” class=”button” />
<div id=”map_canvas” style=”width: 500px; height: 300px”></div>
<input type=”hidden” id=”latitude” value=”18.5203″ />
<input type=”hidden” id=”longitude” value=”73.8567″ />
</body>

If you have any query then drop a comment. 🙂

This Article is TAGGED in , , . BOOKMARK THE permalink.

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code class="" title="" data-url=""> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong> <pre class="" title="" data-url=""> <span class="" title="" data-url="">