By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
459,442 Members | 1,358 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 459,442 IT Pros & Developers. It's quick & easy.

Google Maps API Javascript Problem

P: n/a
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!!!!!!!!!!!!!!!!!!!!!
Jun 27 '08 #1
Share this Question
Share on Google+
1 Reply


P: n/a
SyPhy wrote:
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
Jun 27 '08 #2

This discussion thread is closed

Replies have been disabled for this discussion.