Solved

Javascript Info Window possible syntax issue

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

How to improve team productivity

Quip adds documents, spreadsheets, and tasklists to your Slack experience
- Elevate ideas to Quip docs
- Share Quip docs in Slack
- Get notified of changes to your docs
- Available on iOS/Android/Desktop/Web
- Online/Offline

Join & Write a Comment

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 basic arrays, how to declare them, and how to use them. Introduction and definition: Declare an array and cover the syntax of declaring them: Initialize every index in the created array: Example/Features of a basic arr…
The viewer will learn how to dynamically set the form action using jQuery.

706 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

Need Help in Real-Time?

Connect with top rated Experts

12 Experts available now in Live!

Get 1:1 Help Now