?
Solved

Javascript Info Window possible syntax issue

Posted on 2008-06-19
1
Medium Priority
?
289 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

Are You Using the Best Web Development Editor?

The worlds of web hosting and web development are constantly evolving. Every year we see design trends change, coding standards adapt and new frameworks/CMS created. With such a quick pace of change it’s easy to get lost trying to keep up.

See if your editor made the list.

Question has a verified solution.

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

This article demonstrates how to create a simple responsive confirmation dialog with Ok and Cancel buttons using HTML, CSS, jQuery and Promises
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?
Viewers will learn one way to get user input in Java. Introduce the Scanner object: Declare the variable that stores the user input: An example prompting the user for input: Methods you need to invoke in order to properly get  user input:
The viewer will receive an overview of the basics of CSS showing inline styles. In the head tags set up your style tags: (CODE) Reference the nav tag and set your properties.: (CODE) Set the reference for the UL element and styles for it to ensu…
Suggested Courses

764 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