Google Maps API Javascript Problem

S

SyPhy

Hi all,

First post to this group and I hope I can get some help. I have been
stuck on this all day....

I am using the Google Maps API to plot markers grouped into categories
via checkboxes. Some categories of markers are to load when the page
loads, which are contained in a single XML file, other categories are
to load after the user toggles the checkbox associated with a group of
markers on.

Please see this link for clarification:

http://fddc.987mb.com/index1.htm

Some categories are being read from "location.xml", which loads when
the page loads (http://fddc.987mb.com/location.xml), specifically
these: APDs & DSIs, Independent Living, Airports, Stadiums, and Social
Security. All other categories are to load "on demand" after the user
specifically toggles its checkbox on. For instance, "Targets" is to be
read from "targets.xml", located here: http://fddc.987mb.com/targets.xml

I can't figure out how to do this to save my life. I am assuming that
what I need
is a JS function that sends the signal to load various XML files based
on which checkbox is clicked. If anybody could help me figure out how
to do this it would be greatly appreciated. Thank
you!!!!!!!!!!!!!!!!!!!!!
 
T

Thomas 'PointedEars' Lahn

SyPhy said:
Please see this link for clarification:

http://fddc.987mb.com/index1.htm

Some categories are being read from "location.xml", which loads when the
page loads (http://fddc.987mb.com/location.xml), specifically these:
APDs & DSIs, Independent Living, Airports, Stadiums, and Social Security.
All other categories are to load "on demand" after the user specifically
toggles its checkbox on. For instance, "Targets" is to be read from
"targets.xml", located here: http://fddc.987mb.com/targets.xml

I can't figure out how to do this to save my life. I am assuming that
what I need is a JS function that sends the signal to load various XML
files based on which checkbox is clicked.

This might give you some idea:

var loadedXML = {
location: true,
targets: false
};

function showHideMarkers(type, bShow)
{
if (bShow)
{
// show markers
}
else
{
// hide markers
}
}

function handleClick(checkbox)
{
var type = checkbox.value;

if (checkbox.checked)
{
if (!loadedXML[type])
{
GDownloadUrl(type + ".xml",
function(data) {
loadedXML[type] = true;
createSetMarkers(data);
showHideMarkers(type, true);
});
}
else
{
showHideMarkers(type, true);
}
}
else
{
showHideMarkers(type, false);
}
}

<input type="checkbox" name="markers" value="targets"
onclick="handleClick(this)">
If anybody could help me figure out how to do this it would be greatly
appreciated. Thank you!!!!!!!!!!!!!!!!!!!!!

You're welcome. BTW: Your keyboard appears to be broken.


PointedEars
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,744
Messages
2,569,484
Members
44,903
Latest member
orderPeak8CBDGummies

Latest Threads

Top