Here is a link:
http://pr107m.psur.utk.edu/~lilia/gmap/production/
When a user clicks a building/department on the left, I need an
infowindow for that location to be open, and all others to be
closed.Each infowindow has its own description/location. The
infowindows are created within a loop because the description/location
comes from a database. Right now, each time a user clicks a radio
button, an infowindow opens and none close.
When I use one instance of an infowindow, all infowindows have the
same content/location AND they don't close. When I am creating an
infowindow for each marker, all infowindows display the correct
content/location but still they don't close.
I'm including the code for the Building Locator here because the map
is powered by php:
<form>
<?php while ($array3=mysql_fetch_array($query3))
{?>
<input name="building" value="<?php echo
$array3['building_name'];?
>" type="radio" onClick="popinfoBuild<?php echo
$array3['building_id'];?>();" > <?php echo $array3['building_name'];
if ($array3['building_code']>'') {echo ' ('.
$array3['building_code'].')';}
?><br />
<?php
$buildID=$array3['building_id'];
?>
<script type="text/javascript">
if(popInfoWindow)
{
popInfoWindow.close();
}
function popinfoBuild<?php echo $array3['building_id'];?>() {
var infocontent = '<div id="infobox">'+
'<h2><?php echo $array3['building_name']; ?></h2>'+
<?php
$sql2='SELECT * FROM departments WHERE '.
$buildID.'=departments.departments_buildingID';
$query2=mysql_query($sql2);
if (!$query) {
$message = 'Invalid query: ' .
mysql_error() . "\n";
$message .= 'Whole query: ' .
$sql;
die($message);
}
$i=1;
while ($array2=mysql_fetch_array($query2))
{
if ($buildID===$array2['departments_buildingID'])
{
for ( ;$i<=1 ;$i++)
{ echo '\'<h3>Departments in
this building:</h3>\'+';}
if
($array2['departments_url']>'')
{
echo '\'<h5><a
href="'.$array2['departments_url'].'">'.
$array2['departments_name'].'</a></h5>\'+';
}
else
{
echo
'\'<h5>'.$array2['departments_name']."</h5>'+";
}
if
($array2['departments_room']>'')
{
echo "'<p
class=\'details\'>Main Office: ".
$array2['departments_room']."</p>'+";
}
if
($array2['departments_phone']>'')
{
echo "'<p
class=\'details\'>Phone: ".
$array2['departments_phone']."</p>'+";
}
if
((trim($array2['departments_email']))>'')
{
echo "'<p
class=\'details\'>Email: <a href=\'mailto:".
(trim($array2['departments_email']))."\'>".
(trim($array2['departments_email']))."</a></p>'+";
} echo "'<br />'+";
}
}
?>
'</div';
var infoLatLng = new google.maps.LatLng(<?php echo
$array3['building_infoLat'].', '.$array3['building_infoLng']; ?>);
if(!popInfoWindow)
{
var popInfoWindow = new google.maps.InfoWindow({
content: infocontent,
position: infoLatLng,
center:infoLatLng
});
}
popInfoWindow.open(UTmap);
UTmap.setZoom(17);
}
</script>
<?php } ?>
If I can't get one window to open at a time, and it remains that there
are multiple infowindows open--a button that closes all of them at
once would be satisfactory for now.
I've been doing everything I can think of and searching everywhere I
can think of to find a solution.
Any sort of help would be hugely appreciated.
--
You received this message because you are subscribed to the Google Groups
"Google Maps JavaScript API v3" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/google-maps-js-api-v3?hl=en.