[OpenLayers-Users] Simple Layer Visibility Problem...

Bart van den Eijnden (OSGIS) bartvde at osgis.nl
Fri Aug 7 12:11:26 EDT 2009


Hi,

check out Firebug and you'll see the error:

visible is not defined
http://www.brianjamesbaldwin.com/Map/
Line 56

Try something like:
function Lakeview() {
  parisoaks.setVisibility(document.forms[0].Lakeview.checked);
}

Best regards,
Bart

BrianJ wrote:
> Hi Everyone, I'm really excited to have started working with OpenLayers and
> all the frustrations I'm sure to experience.  
>
> I have a real beginner problem here... I'm simply trying to turn a layer on
> or off with a form check button, and it's not working, searched the forum
> and can't seem to solve the problem...
>
> Thanks
>
> The full code is located here: http://www.brianjamesbaldwin.com/Map/
>
> or...
>
>             var parisoaks = new OpenLayers.Layer.GML("KML", "kml/PO.kml", {
>         			   format: OpenLayers.Format.KML
> 				})
> 			    map.addLayers([parisoaks]);
> 				parisoaks.setVisibility(false);
>
> 		
>
>             }
>         
>         function Lakeview() {
> 			  if (visible === true) {
>         parisoaks.setVisibility(true);
>       } else {
>         parisoaks.setVisibility(false);
> 			}
>
>
> <label>
>    	            <input name="Lakeview" type="checkbox" id="Lakeview"
> value="visible" onclick="Lakeview()" />
>    	          Lakeview</label>
>
>   


-- 
Bart van den Eijnden
OSGIS, Open Source GIS
bartvde at osgis.nl
http://www.osgis.nl




More information about the Users mailing list