Hello all.<br><br>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.)<br><br>In the map file, the layer name for the aerial photograph is "Aerial".<br><br>Here's the script:<br><br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &lt;a href="javascript:becomeAerial()"&gt;Go to aerial mode&lt;/a&gt;<br><br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &lt;script&gt;<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; function becomeAerial()<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; {<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; <br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; for(i=0;i&lt;document.form[0].legendlayername[].length;i++)<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;
 &nbsp;&nbsp;&nbsp; {<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; if(document.form[0].legendlayername[i].value!="Aerial")<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; {<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; document.form[0].legendlayername[i].checked=true;<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; }<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; }<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; document.form[0].submit();<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; }<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;
 &nbsp;&nbsp;&nbsp; &lt;/script&gt;<br><br><br>and the Legend Layer Template is:<br><br><br>[leg_layer_html order=ascending opt_flag=15]<br>&nbsp; &lt;tr bgcolor="#ffffff"&gt;<br>&nbsp;&nbsp;&nbsp; &lt;td&gt;&lt;input type="radio" name="my_legend" onclick="CWCSelectLayer('[leg_layer_name]', true)"[if name=selected value=1] CHECKED[/if] &gt;&lt;/td&gt;<br>&nbsp;&nbsp;&nbsp; &lt;td align="center" width=20&gt;&lt;input type="checkbox" name="legendlayername[]" <br>value="[leg_layer_name]"<br>&nbsp;&nbsp;&nbsp; [if name=layer_status oper=eq&nbsp; value=1]CHECKED[/if]<br>&nbsp;&nbsp;&nbsp; [if name=layer_status oper=eq value=2]CHECKED[/if]&gt;&lt;/td&gt;<br>&nbsp;&nbsp;&nbsp; &lt;td&gt;&lt;img src="[leg_icon width=20 height=18]" width="20" height="20"&lt;/td&gt;<br>&nbsp;&nbsp;&nbsp; [if name=wms_name oper=isnull]<br>&nbsp;&nbsp;&nbsp; &lt;td&gt;&lt;a href="#" onclick="javascript:LegendTemplateLayerInfo('[leg_layer_name]');"&gt;&lt;span
 class="label"&gt;[leg_layer_name]&lt;/span&gt;&lt;/a&gt;&lt;/td&gt;<br>&nbsp; &lt;/tr&gt;<br>&nbsp;&nbsp;&nbsp; [/if]<br>&nbsp;&nbsp;&nbsp; [if name=wms_name oper=isset]<br>&nbsp;&nbsp;&nbsp; &lt;td&gt;&lt;a href="#" onclick="javascript:LegendTemplateLayerInfo('[leg_layer_name]');"&gt;&lt;span class="label"&gt;[metadata name=WMS_TITLE]&lt;/span&gt;&lt;/a&gt;&lt;/td&gt;<br>&nbsp; &lt;/tr&gt;<br>&nbsp;&nbsp;&nbsp; [/if]<br>[/leg_layer_html]<br><br><br><br>---<br><br>I hope somebody could help. Thanks.<br><br><br>Jojin<br><p>
                <hr size=1>Brings words and photos together (easily) with<br> 
<a href="http://us.rd.yahoo.com/mail_us/taglines/PMall/*http://photomail.mail.yahoo.com">PhotoMail </a> - it's free and works with Yahoo! Mail.