Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 5959245
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 22, 20262026-05-22T18:39:27+00:00 2026-05-22T18:39:27+00:00

For the simplicity sake I have put the code for displaying the map and

  • 0

For the simplicity sake I have put the code for displaying the map and the route in the function “initialize“. The Map IS getting displayed, but the route is not. Please point out the error.

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN""http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml">
    <head>
    <meta http-equiv="content-type" content="text/html; charset=utf-8"/>
    <title>Google Maps JavaScript API Example</title>
    <script src="http://maps.google.com/maps/api/js?sensor=false" type="text/javascript"></script>

    <script type="text/javascript"> 

        var map;
        var latlng = new google.maps.LatLng (-34.397, 150.644);

        var directionsDisplay = new google.maps.DirectionsRenderer ();;
        var directionsService = new google.maps.DirectionsService ();

        function initialize ()
        {
            var myOptions = 
            {
                zoom:8,
                center:latlng,
                mapTypeId:google.maps.MapTypeId.ROADMAP
            };

            map = new google.maps.Map (document.getElementById ("map"), myOptions);

            directionsDisplay.setMap (map);

            var initialPoint             = latlng;

            var latlng2 = new google.maps.LatLng (-34.400, 150.744);
            var pointAfterDragging       = latlng2;

            var start = initialPoint;
            var end   = pointAfterDragging;

            var request = {
                        origin:start,
                        destination:end,
                        travelMode:google.maps.TravelMode.DRIVING
                        };


            directionsService.route (request, 
                                function (result, status) 
                                {
                                    if (status == google.maps.DirectionsStatus.OK)
                                    {
                                        directionsDisplay.setDirections (result);
                                    }
                                });
            }

        </script> 
    </head>
    <body onload="initialize()" onunload="GUnload()" topmargin="0" leftmargin="0">
    <div id="map" style="width: 341px; height: 271px"></div>
    <div id="directionsPanel" style="float:right;width:30%;height 100%"></div>
    </body>
    </html> 
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-22T18:39:28+00:00Added an answer on May 22, 2026 at 6:39 pm

    You have two problems.

    First there is no method defined called GUnload.

    Second, the directions you are trying to get returns ZERO_RESULTS. You can always try to alert status to see whether it returns any directions. If it doesn’t nothing will be shown.

    You should try with some other locations instead and it should be fine. You can also pass it addresses instead of latlng’s if you want to try that instead 🙂

    To alert the status you could do this:

    directionsService.route (request, 
                                function (result, status) 
                                {
                                    alert(status);
                                    if (status == google.maps.DirectionsStatus.OK)
                                    {
    
                                        directionsDisplay.setDirections (result);
                                    }
                                });
            }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a few procedures, for simplicity sake, look like the following: public string
I have tables (for simplicity sake) as outlined below: Category -------------------- CategoryId (0 for
I have a few procedures that, for simplicity's sake, look like the following: public
I have (adjusted for the sake of simplicity) a table containing 2 columns -
For the sake of simplicity, let's assume I'm cloning twitter (I'm not). So every
I am creating a custom WPF control that let's say for simplicity sake has
For the sake of simplicity: There is a permission based system in place with
For simplicity lets say I have two flex mxml pages. form.mxml button.mxml If the
For simplicity, i have the following file named test.jsp: <script language=javascript> alert(a$b.replace(/\$/g,k)); </script> I
I am already excited about document databases and especially about CouchDB's simplicity. But I

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.