Hi,
I am working on a google map where you can show lines on the map by checking checkboxes. Lines are displayed according to their category attribute in the xml file. The function that picks up the checkbox click is like this:
[CODE]
function boxclick(box,category) {
if (box.checked) {
show(category);
} else {
hide(category);
}
Another part of the code assigns that category attribute to arrows, so that when a line of “x” category is displayed, the relevant arrows are displayed along with it, to indicate directionality.
I also have a select list which displays the lines by looping through their array and using selectedIndex in a function called handleSelected2. But I can’t get the arrows to display along with the lines from the select box. After trying many, many things, I figure that all I need to do is to call the show(category) function from inside the handleSelected2 function and it should all come together. So I came up with this:
[CODE]function handleSelected2(opt,category) {
for (var h = 0; h <gpolylines.length; h++) {
gpolylines[h].hide();
}
var h = opt.selectedIndex – 1;
if (h > -1) {
gpolylines[h].show();
}
for (var v=0; v<pts.length; v++) {
show(category);
}
}
which gets me lines, but no arrows. You can see it sort of working here:
[URL=”http://www.xelawho.com/map/zonesarrowstest.htm”]http://www.xelawho.com/map/zonesarrowstest.htm
I figure I’ve got to be close, because if I just tell it to show all the arrows (without going through the category filter) like this:
[CODE]function handleSelected2(opt,category) {
for (var h = 0; h <gpolylines.length; h++) {
gpolylines[h].hide();
}
var h = opt.selectedIndex – 1;
if (h > -1) {
gpolylines[h].show();
}
for (var i=0; i<pts.length; i++) {
pts[i].show();
}
}
then all the arrows show up, as you can see here: [URL=”http://www.xelawho.com/map/zonesarrowstest2.htm”]http://www.xelawho.com/map/zonesarrowstest2.htm
I’m not getting any error messages and I’ve tried pretty much everything I can think of… I’ve been tweaking this for days and it’s driving me crazy. Does anybody else have any ideas?
Thanks in advance.