• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 331
  • Last Modified:

javascript google api

Attached codes in javascript for Google API Map 2.0 is working fine.
We prefer to upgrade to Google API Map 3.0 that does not require API Key,
any ideas what we should change in order to match Google API Map 3.0?

Thanks
<%@LANGUAGE="Vbscript" CODEPAGE="65001"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
    <title></title>
    <script src="http://maps.google.com/maps?file=api&amp;v=2&amp;sensor=false&amp;key=ABQIAAAAJxYcItOgkqR8R_oLqIOOTBQBTZKV61x1v48YJEqqfLRn8l4ZShTSK_3kHakNOTnwhzJ3mFGsv0ntTw" type="text/javascript"></script>
    <script type="text/javascript">
        function initialize(from, to) {
            if (GBrowserIsCompatible()) {
                map = new GMap2(document.getElementById("map_canvas"));
                map.addControl(new GSmallMapControl());
                map.addControl(new GMapTypeControl());
                map.setCenter(new GLatLng(37.4419, -122.1419), 13);
                gdir = new GDirections(map, document.getElementById("directions"));
                GEvent.addListener(gdir, "load", onGDirectionsLoad);
                GEvent.addListener(gdir, "error", handleErrors);
                setDirections(from, to, "en_US");
            }
        }
        function setDirections(fromAddress, toAddress, locale) {
            gdir.load("from: " + fromAddress + " to: " + toAddress,
	{ "locale": locale });
        }


        function handleErrors() {
            if (gdir.getStatus().code == G_GEO_UNKNOWN_ADDRESS) {
                //alert("Error code: " + gdir.getStatus().code);
                document.getElementById("span_ID").innerHTML = "Invalid Address. Error code:  " + gdir.getStatus().code;
            }
            else if (gdir.getStatus().code == G_GEO_SERVER_ERROR) {
                //alert("Error code: " + gdir.getStatus().code);
                document.getElementById("span_ID").innerHTML = "Error code: " + gdir.getStatus().code;
            }
            else if (gdir.getStatus().code == G_GEO_MISSING_QUERY) {
                //alert("Error code: " + gdir.getStatus().code);
                document.getElementById("span_ID").innerHTML = "Error code: " + gdir.getStatus().code;
            }
            else if (gdir.getStatus().code == G_GEO_BAD_KEY) {
                //alert("Error code: " + gdir.getStatus().code);
                document.getElementById("span_ID").innerHTML = "Error code: " + gdir.getStatus().code;
            }
            else if (gdir.getStatus().code == G_GEO_BAD_REQUEST) {
                //alert("A directions request could not be successfully parsed.\n Error code: " + gdir.getStatus().code);
                document.getElementById("span_ID").innerHTML = "A directions request could not be successfully parsed.\n Error code: " + gdir.getStatus().code;
            }
            else alert("An unknown error occurred.");

        }
        function onGDirectionsLoad() { }
</script>
</head>
<%
GoogleFromAddressValue="12 Main Street ave. Los Angeles, CA 90032" 
GoogleToAddressValue="100 Airport Blvd. Los Angeles, CA 90045"
%>
<body onload="initialize('<%=GoogleFromAddressValue%>','<%=GoogleToAddressValue%>')" onunload="GUnload()" >
<%Function ContactGoogle()
p="<table cellpadding=""3"" cellspacing=""2""   class=""GoogleMapMasterInfor"">"
p=p & "<tr><td colspan=""2""><h3>Vanpool Contact Information</h3></td><td colspan=""3"" align=""right""><a href=""javascript:history.go(-1)"" class=""BackButton"">Back</a>&nbsp;</td></tr>"
p=p & "<tr><td><span class=""GoogleContactTdSubject"">ID:</span></td><td>" & RefNo & "</td><td width=""15""><br></td><td><span class=""GoogleContactTdSubject"">Origin:</span></td><td>" & OriginAddress & "</td></tr>"
p=p & "<tr><td><span class=""GoogleContactTdSubject"">Name:</span></td><td>" & PersonName & "</td><td><br></td><td><br></td><td>" & OriginCity & ", " & OriginState & " " & OriginZip & "</td></tr>"
p=p & "<tr><td><span class=""GoogleContactTdSubject"">Phone:</span></td><td>" & PhoneNo  & "</td><td><br></td><td><span class=""GoogleContactTdSubject"">Destination:</td><td>" & DestinationAddress & "</td></tr>"
p=p & "<tr><td><span class=""GoogleContactTdSubject"">Email:</span></td><td>" & EmailUrl & "</td><td><br></td><td><br></td><td>" & DestinationCity & ", " & DestinationState & " " & DestinationZip & "</td></tr>"
p=p & "<tr><td><span class=""GoogleContactTdSubject"">Employer:</span></td><td>" & EmployerName & "</td><td><br></td><td><span class=""GoogleContactTdSubject"">Work Hours:</span></td><td>" & WorkHours  & "</td></tr>"
p=p & "<tr><td colspan=""5"" align=""left""><span class=""GoogleContactTdSubject"" id=""span_ID""></span><br>" 
p=p & "<div id=""map_canvas"" style=""width: 605px; height: 370px;  border: 1px solid #C0C0C0;""></div>"
p=p & "</td></tr>"
p=p & "</table>"
ContactGoogle=p
End Function
Response.write ContactGoogle()
%>
</body>
</html>

Open in new window

0
Webboy2008
Asked:
Webboy2008
1 Solution
 
nishant joshiTechnology Development ConsultantCommented:
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now