<!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
src="http://maps.google.com/maps?file=api&v=2&key=KEYHERE;sensor=true"
type="text/javascript"></script>
<script type="text/javascript">
function initialize() {
var latitude = "53.902550";
var longitude = "27.563101";
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" style="width:100%; height:100%"></div>
</body>
</html>
In the place KEY HERE just paste ur key it will work.........
On Wed, Aug 4, 2010 at 6:22 AM, Andrew Balakhanov <
[email protected]> wrote:
> 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'));
>
> --
> You received this message because you are subscribed to the Google Groups
> "Google Maps JavaScript API v3" group.
> To post to this group, send email to
> [email protected].
> To unsubscribe from this group, send email to
> [email protected]<google-maps-js-api-v3%[email protected]>
> .
> For more options, visit this group at
> http://groups.google.com/group/google-maps-js-api-v3?hl=en.
>
>
--
You received this message because you are subscribed to the Google Groups
"Google Maps JavaScript API v3" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/google-maps-js-api-v3?hl=en.