Solved

Javascript Info Window possible syntax issue

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

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

International Data Corporation (IDC) prognosticates that before the current the year gets over disbursing on IT framework products to be sent in cloud environs will be $37.1B.
Today, the web development industry is booming, and many people consider it to be their vocation. The question you may be asking yourself is – how do I become a web developer?
The viewer will learn the basics of jQuery, including how to invoke it on a web page. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery.: (CODE)
Learn how to create flexible layouts using relative units in CSS.  New relative units added in CSS3 include vw(viewports width), vh(viewports height), vmin(minimum of viewports height and width), and vmax (maximum of viewports height and width).

707 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