Wednesday, February 15, 2012

Displaying Google Map using JavaScript And Google API



Displaying simple Google  map using Google Map API and Java Script



<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Default.aspx.cs" Inherits="_Default" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title>Untitled Page</title>
   
   
    <meta http-equiv="content-type" content="text/html; charset=utf-8"/>
   
    <script src="http://maps.google.com/maps?file=api&amp;v=2&amp;
    key=ABQIAAAAcl" type="text/javascript"></script>
   
<script type="text/javascript">

function load()
{
      if (GBrowserIsCompatible()) {
         var point;
         var map=new GMap2(document.getElementById("map"));
         map.setCenter(new GLatLng(42.351505,71.094455), 5);
         map.addControl(new GOverviewMapControl());
         map.enableDoubleClickZoom();
         map.enableScrollWheelZoom();
         map.addControl(new GMapTypeControl());
         map.addControl(new GSmallMapControl());              
      }
    }
</script>
</head>
       
<body onload="load();" onunload="GUnload()" style="
        background-color:Transparent">
<div id="map" style="width: 900px; height: 500px"></div>
</body>       
       
</html>

No comments:

Post a Comment