Solved

Javascript Info Window possible syntax issue

Posted on 2008-06-19
1
286 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
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

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
document.write() deleting all existing HTML 5 50
key press alert 2 32
Ajax and PHP 4 29
Where does legacy ASP.NET initialize language? 2 22
Introduction Since I wrote the original article about Handling Date and Time in PHP and MySQL (http://www.experts-exchange.com/articles/201/Handling-Date-and-Time-in-PHP-and-MySQL.html) several years ago, it seemed like now was a good time to updat…
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.
Viewers will learn about if statements in Java and their use The if statement: The condition required to create an if statement: Variations of if statements: An example using if statements:
The viewer will learn how to count occurrences of each item in an array.

840 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