[Chameleon] javascript to turn on a layer_where to find javascript error

Delfos, Jacob jacob.delfos at maunsell.com
Wed Mar 15 18:35:27 EST 2006


Jojin,
 
Please CC to the list with with replies.
 
You should download the Firefox browser, and then use the JavaScript
Console under the tools menu. Then load the page, activate the link, and
see if anything shows up there. If so, please let us know what it says.
 
regards,
 
Jacob
 


________________________________

	From: JR Santillan [mailto:dgr8_39991 at yahoo.com] 
	Sent: 15 March 2006 16:25
	To: Delfos, Jacob
	Subject: RE: [Chameleon] javascript to turn on a layer_where to
find javascript error
	
	
	Hello Jacob.
	
	Sorry for not telling you that I changed some of the contents of
the script you gave me.
	
	I tried running the script but didn't work. I tried the script
provided by Julien but the same results: nothing happens after clicking
the link.
	
	Julien's script is below:
	
	<script>
	            function becomeAerial()
	                 {
	
for(i=0;document.forms[0].elements['legendlayername[]'][i];i++)
	                     {
	
if(document.forms[0].elements['legendlayername[]'][i].value=="Aerial")
	                        {
	
document.forms[0].elements['legendlayername[]'][i].checked=true;
	                         }
	                     }
	                         document.forms[0].submit();
	                }
	            </script>
	
	
	By the way where can I find the an error log for "javascript"?
	
	Thanks.
	
	
	Jojin
	
	"Delfos, Jacob" <jacob.delfos at maunsell.com> wrote: 

		Jojin,
		
		Have you tried implementing the script? If it didn't
work, did you get
		any javascript errors?
		
		By the way, the script you pasted below isn't exactly
what I gave you,
		but I think Julien has pointed out the typos. Note that
you have
		actually changed the script to turn the aerial layer on,
rather than
		turn all the other layers off (which is what you
initially said you
		wanted to do). You can change this behaviour using the
!= operator, and
		set layer checked to 'false'.
		
		Regards,
		
		Jacob
		
		
		________________________________
		
		From: chameleon-bounces at lists.maptools.org
		[mailto:chameleon-bounces at lists.maptools.org] On Behalf
Of JR Santillan
		Sent: 14 March 2006 19:01
		To: Chameleon
		Subject: [Chameleon] javascript to turn on a layer
		
		
		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:
		
		Go to aerial
		mode <javascript:becomeAerial()> 
		
		
		
		
		and the Legend Layer Template is:
		
		
		[leg_layer_html order=ascending opt_flag=15]
		
		
		onclick="CWCSelectLayer('[leg_layer_name]', true)"[if
name=selected
		value=1] CHECKED[/if] >
		
		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]>
		
		height="20"
		[if name=wms_name oper=isnull]
		
	
onclick="javascript:LegendTemplateLayerInfo('[leg_layer_name]');">
		class="label">[leg_layer_name]
		
		[/if]
		[if name=wms_name oper=isset]
		
	
onclick="javascript:LegendTemplateLayerInfo('[leg_layer_name]');">
		class="label">[metadata name=WMS_TITLE]
		
		[/if]
		[/leg_layer_html]
		
		
		
		---
		
		I hope somebody could help. Thanks.
		
		
		Jojin
		
		




More information about the Chameleon mailing list