I have done a decent amount of work with the Google Earth plugin and its easy to open a balloon using the api and javascript. However I can't seem to figure out how to open another placemark's balloon programmatically using KML and javascript in the Google Earth Enterprise client.
I am rendering the placemark's balloons with html in the CDATA of the Balloon KML with two links. The goal is that the two links will close the current balloon and open another placemark's balloon accordingly.
Here is the html the balloon is rendering (just a table):
<BalloonStyle>
<bgColor>ffdfdfdf</bgColor>
<text>
<![CDATA[
<html><head></head><body>
<b><font size="+1.5"><a id='prevMonth' href="#">Last Month</a><center>$[Month] </center><a id='nextMonth' href="#">Next Month</a></font></b>
<div id="content" align = "center">
<table border = "0" width="450"><tr bgcolor = "#005497"><th colspan="2"><em><b><font color="#D9D9DB">Details</b></em></th></tr>
<tr bgcolor = "#ffffff"><td width="150"><b>County</b></td><td width="300">$[Details]</td></tr>
<tr bgcolor = "#ffffff"><td width="150"><b>Segment</b></td><td width="300">$[Segment]</td></tr>
....
</table>
</div>
</body>
</html>
]]>
</text>
</BalloonStyle>
I have tried setting the href
of the <a>
tags to the ids of another placemark:
<a id='prevMonth' href='#differentPlacemarkID'>Last Month</a>
also tried this
<script>
function openUp(){
window.open('kmzFile.kmz#differentPlacemarkID');
}
</script>
<a onclick='openUp();'>Last Month</a>
and that centers the globe around the correct placemark but won't open the balloon.
Any help would be greatly appreciated! Thanks!
Try
<a id='prevMonth' href='#differentPlacemarkID;balloonFlyto'>Last Month</a>
or
<a id='prevMonth' href='#differentPlacemarkID;flyto'>Last Month</a>