Good day, dear developers.
Can you please help me in advice.
So, I try to start use API for Google maps. And I try simple example,
but it doesn't work.
I have code:
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://
www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<style type="text/css">
html { height: 100% }
body { height: 100%; margin: 0px; padding: 0px }
#map_canvas { height: 100% }
</style>
<script type="text/javascript"
src="
http://maps.google.com/maps/api/js?sensor=true">
</script>
<script type="text/javascript">
var GOOGLEMAPS = "
http://maps.google.com/maps?
f=q&hl=en&ie=UTF8&z=10&iwloc=addr&om=1&q=";
var latitude = "53.902550";
var longitude = "27.563101";
var w = window.open(GOOGLEMAPS+latitude+","+longitude
+"&geocode=","map");
//Init a new map
var map = new GMap2(document.getElementById('map'));
map.addControl(new GSmallMapControl());
map.setCenter(new GLatLng(56.87, 14.80), 11);
// Creating a new marker
var marker = new GMarker(new GLatLng(56.87, 14.80))
// Adding a click-event to the marker
GEvent.addListener(marker, 'click', function() {
// When clicked, open an Info Window
marker.openInfoWindowHtml('Some text');
});
// Add marker to map
map.addOverlay(marker);
</script>
<title>Insert title here</title>
</head>
<body onload="initialize()">
<div id="map_canvas" style="width:100%; height:100%"></div>
</body>
</html>
But it's leads to error :
GMap2 is not defined
var map = new GMap2(document.getElementById('map'));