You can show google map on your website for free. to do and use it successfully on your site you have to do the following steps:
* Register for a key with your domain, its must.
* Load google map api library on your web page as follows:
<script src= "http://maps.google.com/maps?file=api&v=2&key=yourkey" type="text/javascript"></script>
now u r ready to use google map api. take a div on page where you want to load the map like:
<div id="map"></div>
create your own java script code file to write code to use google map api libraries. write this basic code there:
function LoadMap()
{
if (GBrowserIsCompatible())
{
map = new GMap2(document.getElementById("map"),{size:new GSize(650,450)});
map.setCenter(new GLatLng(37.4419, -122.1419), 13);
}
}
*** Remember, you can set size of the div if its visible & that size will be used to load map. But, if you made the div style to 'display:none', then div's size won't be taken by javascript & that will be treated like 0 size & map will be loaded to its default size(500px X 300px). Then you have to pass extra parameter to set the size.
*** Always use GUnload() on body unload event to ensure that, google api resources are released when page is unloaded.
See documentation for all details more advanced features.
Subscribe to:
Post Comments (Atom)










0 comments:
Post a Comment