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:
Expand|Select|Wrap|Line Numbers
- function boxclick(box,category) {
- if (box.checked) {
- show(category);
- } else {
- hide(category);
- }
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:
Expand|Select|Wrap|Line Numbers
- function handleSelected2(opt,category) {
- for (var h = 0; h <gpolylines.length; h++) {
- gpolylines[h].hide();
- }
- h = opt.selectedIndex - 1;
- if (h > -1) {
- gpolylines[h].show();
- }
- for (var v=0; v<pts.length; v++) {
- show(category);
- }
- }
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:
Expand|Select|Wrap|Line Numbers
- 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();
- }
- }
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.