In our last Google Maps API v3 example we saw how info windows appeared on user click. We saw why such a thing is necessary and the benefits of that! Today we will look at a very simple example, where in we will place a single marker on the map! Something like a simple marker example in this post!
Our today's code is below!
<html>
<head>
<title>
Google Maps API v3 - Simple info window only example
</title>
<script type="text/javascript" src="http://maps.google.com/maps/api/js?sensor=false">
</script>
<script type="text/javascript">
var map;
function click_window()
{
map = new google.maps.Map(document.getElementById("map"),
{
zoom: 5,
center: new google.maps.LatLng(22.7964,79.5410),
mapTypeId: google.maps.MapTypeID.ROADMAP
});
var html = "This is a single info window!";
var infowindow = new google.maps.InfoWindow(
{
content: html,
position: new google.maps.LatLng(22.7964,79.5410)
});
infowindow.open(map);
}
</script>
</head>
<body onload="click_window()" onload="GUnload()">
<div id="map" style="width:100%; height: 100%">
</div>
</body>
</html>
Copy and try out the code for yourself! If you have any queries regarding the code comment on the post or feel free to drop me a mail.
Our today's code is below!
<html>
<head>
<title>
Google Maps API v3 - Simple info window only example
</title>
<script type="text/javascript" src="http://maps.google.com/maps/api/js?sensor=false">
</script>
<script type="text/javascript">
var map;
function click_window()
{
map = new google.maps.Map(document.getElementById("map"),
{
zoom: 5,
center: new google.maps.LatLng(22.7964,79.5410),
mapTypeId: google.maps.MapTypeID.ROADMAP
});
var html = "This is a single info window!";
var infowindow = new google.maps.InfoWindow(
{
content: html,
position: new google.maps.LatLng(22.7964,79.5410)
});
infowindow.open(map);
}
</script>
</head>
<body onload="click_window()" onload="GUnload()">
<div id="map" style="width:100%; height: 100%">
</div>
</body>
</html>
Copy and try out the code for yourself! If you have any queries regarding the code comment on the post or feel free to drop me a mail.
Comments
Post a Comment
Please leave your comments here...