Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

javascript google api

Posted on 2011-09-14
2
Medium Priority
?
315 Views
Last Modified: 2012-05-12
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
Comment
Question by:Webboy2008
2 Comments
 
LVL 14

Accepted Solution

by:
nishant joshi earned 2000 total points
ID: 36538157
0

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article discusses how to create an extensible mechanism for linked drop downs.
This article demonstrates how to create a simple responsive confirmation dialog with Ok and Cancel buttons using HTML, CSS, jQuery and Promises
The viewer will learn the basics of jQuery, including how to invoke it on a web page. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery.: (CODE)
The viewer will learn the basics of jQuery including how to code hide show and toggles. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery…
Suggested Courses

886 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question