If I understand what you want correctly, this is shown in the examples.  

 

I used it in my project (demo here):  http://marjie.info/map/

 

In the javascript, after initialiazing your map:

 

map.addControl(new OpenLayers.Control.LayerSwitcher(

                { 'div': OpenLayers.Util.getElement('right') }));

 

In the html:

 

<div id="right" class="olControlLayerSwitcher"></div>

 

You will probably want to override the ControlLayerSwitcher style in your CSS 
as well.

 

-          Marjie

 

From: [email protected] [mailto:[email protected]] On 
Behalf Of Tonton
Sent: Tuesday, May 25, 2010 6:26 AM
To: [email protected]
Subject: [OpenLayers-Users] [openlayers users]

 

hello 

i would like to have a layers switcher in external of the map box.

is it possible to use OL for or is it necessary to use a other JS library with



i thing about something like that 

</script>
 function valider()
{  var valeur = document.choisir.nomdeCouche;

    for (var i=1;i < valeur.length; i++)
    {    if ( valeur[i].checked )
        {   map.layerContainerDiv.children([valeur[i].value].setvisible=true);
    }   else 
{map.layerContainerDiv.children([valeur[i].value]).setvisible=false;}
  }
}</script>

 <FORM form id='choisir' name='choisir' method=get action="javascript:void(0);" 
onSubmit="valider(); return false;">
<input id="wms1" name="nomdeCouche" type="checkbox"  value="wms1"><br>
<input id="wms2" name="nomdeCouche" type="checkbox" value="wms2"><br>
<input id="wms3" name="nomdeCouche" type="checkbox" value="wms3"><br>
<input id="wms4" name="nomdeCouche" type="checkbox" value="wms4"><br>
<input type="submit" value="ajouter" >
                        </FORM>

thanks for your comments

_______________________________________________
Users mailing list
[email protected]
http://openlayers.org/mailman/listinfo/users

Reply via email to