[Chameleon] javascript to turn on a layer
JR Santillan
dgr8_39991 at yahoo.com
Tue Mar 14 06:00:41 EST 2006
Hello all.
I am trying to use javascript to turn on a layer (an aerial photograph) but its not working. Jacob Delfos gave a rough draft of the script and i experimented on it. (I am not knowlegdeable in Javascript.)
In the map file, the layer name for the aerial photograph is "Aerial".
Here's the script:
<a href="javascript:becomeAerial()">Go to aerial mode</a>
<script>
function becomeAerial()
{
for(i=0;i<document.form[0].legendlayername[].length;i++)
{
if(document.form[0].legendlayername[i].value!="Aerial")
{
document.form[0].legendlayername[i].checked=true;
}
}
document.form[0].submit();
}
</script>
and the Legend Layer Template is:
[leg_layer_html order=ascending opt_flag=15]
<tr bgcolor="#ffffff">
<td><input type="radio" name="my_legend" onclick="CWCSelectLayer('[leg_layer_name]', true)"[if name=selected value=1] CHECKED[/if] ></td>
<td align="center" width=20><input type="checkbox" name="legendlayername[]"
value="[leg_layer_name]"
[if name=layer_status oper=eq value=1]CHECKED[/if]
[if name=layer_status oper=eq value=2]CHECKED[/if]></td>
<td><img src="[leg_icon width=20 height=18]" width="20" height="20"</td>
[if name=wms_name oper=isnull]
<td><a href="#" onclick="javascript:LegendTemplateLayerInfo('[leg_layer_name]');"><span class="label">[leg_layer_name]</span></a></td>
</tr>
[/if]
[if name=wms_name oper=isset]
<td><a href="#" onclick="javascript:LegendTemplateLayerInfo('[leg_layer_name]');"><span class="label">[metadata name=WMS_TITLE]</span></a></td>
</tr>
[/if]
[/leg_layer_html]
---
I hope somebody could help. Thanks.
Jojin
---------------------------------
Brings words and photos together (easily) with
PhotoMail - it's free and works with Yahoo! Mail.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.maptools.org/pipermail/chameleon/attachments/20060314/720836cf/attachment-0001.html
More information about the Chameleon
mailing list