This is my select option.
<select id="sel_dist" onChange="seldist();">
<option value="layer1" selected=selected>None</option>
<option value="layer2">1</option>
<option value="layer3">2</option>
</select>
This is my layer in Openlayers
layer1 = new OpenLayers.Layer.WMS("Map",serverWMS,
{layers: 'test:Layer1',transparent: true},
{isBaseLayer:false, visibility: false});
What i want to do is when i select option "Layer 1", layer 1 should be visible.
function seldist()
{
var layer_name=$("#sel_dist option:selected").val()
layer_name.setVisibility(true);
}
But when i use layer_name.setVisibility
it assumes 'layer_name' as layer name but i want to use it as variable only. Any help would be much appreciated.