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 8730029
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T08:56:26+00:00 2026-06-13T08:56:26+00:00

I have retrieved the data from xml..Generated Sidebar. I want to open infowindow on

  • 0

I have retrieved the data from xml..Generated Sidebar. I want to open infowindow on click on the sidebar.. Tried so many examples and codes but not succeeded… Can you please suggest what should be function declaration for myclick function:

Below i am mentioning my code…I will be grateful to you if any one can help!!

var gmarkers = [];

function load() {
 var side_bar_html = "<div class=\"pro_curved-hz-2\"><div class=\"pro_text-shadow\" style=\"height: 250px;overflow-x:hidden;overflow-y: scroll;\">";
  var map = new google.maps.Map(document.getElementById("map"), {
    center: new google.maps.LatLng(<?php echo $SelectedLatitude; ?>,<?php echo $SelectedLongitude; ?>),
    zoom: <?php echo $Zoom; ?>,
    mapTypeId: 'roadmap'

  });
  var infoWindow = new google.maps.InfoWindow;

  // Change this depending on the name of your PHP file
  downloadUrl("/map.php", function(data) {
    var xml = data.responseXML;
    var markers = xml.documentElement.getElementsByTagName("marker");
    var count=markers.length;
    if(count>0)
    side_bar_html += '<span class=\"pro_info pro_info-indent pro_info_success\">' + count + ' result found!! </span><div class=clear></div>';
    else
    side_bar_html += '<span class=\"pro_info pro_info-indent pro_info_warning\"> No Result found!! </span><div class=clear></div>';

    for (var i = 0; i < markers.length; i++) {
      var name = markers[i].getAttribute("name");
      var address = markers[i].getAttribute("address");
      var type = markers[i].getAttribute("type");
      var link= '/Place';
      var point = new google.maps.LatLng(
          parseFloat(markers[i].getAttribute("lat")),
          parseFloat(markers[i].getAttribute("lng")));
      var html = "<b>" + name + "</b> <br/>" + address;
      var Mainicon = customMainIcons[type] || {};
      var marker = new google.maps.Marker({
        map: map,
        position: point,
        icon: Mainicon.icon,
        shadow: Mainicon.shadow,
        animation: google.maps.Animation.DROP,
      });
        gmarkers[i] = marker;
      side_bar_html += '<div class=\"pro_curved-hz-2-1\" onclick="myclick('+i+');" onmouseover="mymouseover('+i+');" onmouseout="mymouseout('+i+');" ><div class=\"pro_text-shadow\"><a href=' + link + '>' + name + '</a><br>' + address + '</div></div>';
      bindInfoWindow(marker, map, infoWindow, html, side_bar_html);


    }
    side_bar_html += "</div></div>";
  });
}

      function myclick(index) { 

        }

      function mymouseover(i) {
        gmarkers[i].setAnimation(google.maps.Animation.BOUNCE);
        }

      function mymouseout(i) {
        gmarkers[i].setAnimation(null);
        }

function bindInfoWindow(marker, map, infoWindow, html, side_bar_html) {

document.getElementById("SideBar").innerHTML = side_bar_html;

    google.maps.event.addListener(marker,'mouseover', function() {
    //marker.setAnimation(google.maps.Animation.BOUNCE);
    //setTimeout(function(){ marker.setAnimation(null); }, 750);
    infoWindow.setContent(html);
    infoWindow.open(map, marker);
    });

    google.maps.event.addListener(marker,'mouseout', function() {
    infoWindow.setContent(html);
    infoWindow.close(map, marker);
    });

    var p=<?php echo $Zoom; ?>;
  google.maps.event.addListener(marker, 'click', function() {
    p+=1;
    if(p>=20)
    {
    infoWindow.setContent(html);
    infoWindow.open(map, marker);
    }
    else
    {
    map.setZoom(p);
    map.setCenter(marker.getPosition());
    }
  });
}
function downloadUrl(url, callback) {
  var request = window.ActiveXObject ?
      new ActiveXObject('Microsoft.XMLHTTP') :
      new XMLHttpRequest;

  request.onreadystatechange = function() {
    if (request.readyState == 4) {
      request.onreadystatechange = doNothing;
      callback(request, request.status);
    }
  };

  request.open('GET', url, true);
  request.send(null);
}

function doNothing() {}

//]]>

  • 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-06-13T08:56:27+00:00Added an answer on June 13, 2026 at 8:56 am

    Here is an example that does what you are requesting (with function closure and a createMarker function).

    Here is an example that doesn’t use function closure.

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

Sidebar

Related Questions

I have some XML data retrieved from a web service that I use to
I have this code to display the data retrieved from DB in accounts_view.php :
i wan to retrieve data from query involving many tables. i have a query
I have DropDownList with CascadingDropDown extender. If I want to retrieve data from the
I have a GridView in android which I fill it with data retrieved from
I am trying to return some data retrieved from an xml file and then
I have some data retrieved from web in following format (in a stream): {parts:[
I have a website that needs to pull information from two diffferent XML data
i have a stored procedure that has to retrieve data from multiple tables something
I have a situation where I need to retrieve data from a query which

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.