On 4 November 2010 15:03, xelawho <[email protected]> wrote: > > or does it not matter as long as it's consistent?
Doesn't matter. A loop is a loop. > and if it is right, how come I get a "category is not defined" error > when I try to use it here: http://www.xelawho.com/map/zones.htm Most of that function, show(), contains groups of lines like this for (var i=0; i<pts.length-1; i++) { if (pts[i].mycategory == category) { pts[i].show(); } } with two } because of the loop and the if. The last such group looks like this: for (var i=0; i<gpolygons.length; i++) if (gpolygons[i].mycategory == category) { gpolygons[i].show(); } } which is syntactically correct. But the last } is the end of the **function** because you've missed the first { after the for(). Because that's the end of the function, the next line document.getElementById(category+"box").checked = true; is outside the function, and is executed as the page loads. At that point, category is undefined. Putting the { back in where it's missing will bring that line back inside the function. -- You received this message because you are subscribed to the Google Groups "Google Maps API V2" group. To post to this group, send email to [email protected]. To unsubscribe from this group, send email to [email protected]. For more options, visit this group at http://groups.google.com/group/google-maps-api?hl=en.
