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

  • Home
  • SEARCH
  • 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 782231
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 14, 20262026-05-14T20:21:16+00:00 2026-05-14T20:21:16+00:00

For simplicity sake, lets use the XML example on Econym’s site. http://econym.org.uk/gmap/example_map3.htm Once clicked,

  • 0

For simplicity sake, lets use the XML example on Econym’s site.

http://econym.org.uk/gmap/example_map3.htm

Once clicked, I would like icon balloon to be displayed in the middle of the map.

What might I need to add to Mike’s code to get this to work? I apologize for asking a lot..

Thanks in advance.

<script type="text/javascript">
    //<![CDATA[

    if (GBrowserIsCompatible()) {
side_bar
      var side_bar_html = "";


      var gmarkers = [];


      function createMarker(point,name,html) {
        var marker = new GMarker(point);
        GEvent.addListener(marker, "click", function() {
          marker.openInfoWindowHtml(html);
        });

        gmarkers.push(marker);

        side_bar_html += '<a href="javascript:myclick(' + (gmarkers.length-1) + ')">' + name + '<\/a><br>';
        return marker;
      }



      function myclick(i) {
        GEvent.trigger(gmarkers[i], "click");
      }



      var map = new GMap2(document.getElementById("map"));
      map.addControl(new GLargeMapControl());
      map.addControl(new GMapTypeControl());
      map.setCenter(new GLatLng( 43.907787,-79.359741), 9);



      GDownloadUrl("example.xml", function(doc) {
        var xmlDoc = GXml.parse(doc);
        var markers = xmlDoc.documentElement.getElementsByTagName("marker");

        for (var i = 0; i < markers.length; i++) {
          // obtain the attribues of each marker
          var lat = parseFloat(markers[i].getAttribute("lat"));
          var lng = parseFloat(markers[i].getAttribute("lng"));
          var point = new GLatLng(lat,lng);
          var html = markers[i].getAttribute("html");
          var label = markers[i].getAttribute("label");

          var marker = createMarker(point,label,html);
          map.addOverlay(marker);
        }

        document.getElementById("side_bar").innerHTML = side_bar_html;
      });
    }

    else {
      alert("Sorry, the Google Maps API is not compatible with this browser");
    }


    //]]>
    </script>
  • 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-14T20:21:17+00:00Added an answer on May 14, 2026 at 8:21 pm

    What you are looking to use is the GMap2.setCenter()(Google API Documentation) function.

    So, you should be able to use it as follows:

    GEvent.addListener(marker, "click", function() {
      marker.openInfoWindowHtml( html );
      map.setCenter( marker.getLatLng() );
    });
    

    You could, of course, change the order of those actions to your taste.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am creating a custom WPF control that let's say for simplicity sake has
I have a few procedures, for simplicity sake, look like the following: public string
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 generally split a lot of my configuration (i.e. the contents of
For simplicity, i have the following file named test.jsp: <script language=javascript> alert(a$b.replace(/\$/g,k)); </script> I
Let me apologize in advance for the simplicity of this question (I heard Jeff's
I'm impressed with the simplicity of Microsoft's Virtual Earth Street Address search service. My
One of the really nice things about python is the simplicity with which you
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.