Solved

Javascript Info Window possible syntax issue

Posted on 2008-06-19
1
287 Views
Last Modified: 2013-11-19
I am using the following code to display an address in a Google Maps information window on a plotted map:

function initializePoint(pointData) {
      var point = new GLatLng(pointData.latitude, pointData.longitude);
      var marker = new GMarker(point);
      var listItem = document.createElement('li');
      var listItemLink = listItem.appendChild(document.createElement('a'));
      listItemLink.href = "#";
      listItemLink.innerHTML = '<strong>' + pointData.address + ' </strong><span>' + pointData.city + ', ' + pointData.state + ' </span>';
      
      var focusPoint = function() {
            deselectCurrent();
            listItem.className = 'current';
            deselectCurrent = function() { listItem.className = ''; }
            marker.openInfoWindowHtml(pointData.address);
            map.panTo(point);
            return false;
      }

      GEvent.addListener(marker, 'click', focusPoint);      
      listItemLink.onclick = focusPoint;

      document.getElementById('sidebar-list').appendChild(listItem);

      map.addOverlay(marker);
}

This is working fine and I am trying to add a tabbed window instead of the popup window and I cannot seem to pass the dynamic value of address like I was with the code above.  I am assuming its some sort of syntax issue.  New code is below
function initializePoint(pointData) {
	var point = new GLatLng(pointData.latitude, pointData.longitude);
	var marker = new GMarker(point);
	var listItem = document.createElement('li');
	var listItemLink = listItem.appendChild(document.createElement('a'));
	var visible = false;
 
	listItemLink.href = "#";
	listItemLink.innerHTML = '<strong>' + pointData.address + ' </strong><span>' + pointData.city + ', ' + pointData.state + ' (' + pointData.height + 'm)</span>';
	
	var focusPoint = function() {
		deselectCurrent();
		listItem.className = 'current';
		deselectCurrent = function() { listItem.className = ''; }
	var infoTabs = [
	new GInfoWindowTab("Info", "Data '(pointData.address)'"),
	new GInfoWindowTab("Visual", "Photo & Stree View Here")
	];
	marker.openInfoWindowTabsHtml(infoTabs,{
		selectedTab:0,
		maxWidth:300
	});
		map.panTo(point);
		return false;
	}

Open in new window

0
Comment
Question by:pda4me
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
1 Comment
 

Accepted Solution

by:
pda4me earned 0 total points
ID: 21824943
This has a string constant in there.
new GInfoWindowTab("Tab A", "pointData.address"),

I needed aa string variable, like:
new GInfoWindowTab("Tab A", pointData.address),
0

Featured Post

PeopleSoft Has Never Been Easier

PeopleSoft Adoption Made Smooth & Simple!

On-The-Job Training Is made Intuitive & Easy With WalkMe's On-Screen Guidance Tool.  Claim Your Free WalkMe Account Now

Question has a verified solution.

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

Introduction Knockoutjs (Knockout) is a JavaScript framework (Model View ViewModel or MVVM framework).   The main ideology behind Knockout is to control from JavaScript how a page looks whilst creating an engaging user experience in the least …
Browsers only know CSS so your awesome SASS code needs to be translated into normal CSS. Here I'll try to explain what you should aim for in order to take full advantage of SASS.
The viewer will learn how to dynamically set the form action using jQuery.
The viewer will learn the benefit of using external CSS files and the relationship between class and ID selectors. Create your external css file by saving it as style.css then set up your style tags: (CODE) Reference the nav tag and set your prop…

733 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