Page 1 of 1

Javascrip Layer switch

Posted: Thu Apr 03, 2008 10:09 am
by kerbenok
Hi,

maybe some javascript CMSms Guru can help me out.

What I want to do. Actually I would like to have a photo gallery where I can see one image after another. On a klick I would like to have a Project text layer over the Image. I always want to have access to the project text whereever I'm in the picture stream.

How I want to do it. I would like to use a Javascript Layer switch.

I have a layer with the text and a layer with an image. When I hit the button the image layer should be switched off, the text layer should be switched on. When I hit the button again it should be the other way round. First you see the code which is standing in the header between the {literal} tags. The second code is placed on the site, as I think to found out I don't need the {literal} Tag.

Code: Select all

{literal}
</style>
		<csactions>
			<csaction name="c417e6161" class="ShowHide" type="onevent" val0="ImgPro" val1="2"></csaction>
			<csaction name="c417e6262" class="ShowHide" type="onevent" val0="Text" val1="2"></csaction>
		</csactions>
		<csscriptdict import="import">
			<__script__ type="text/javascript" src="Uploads/Images/HTML/Content/CSScriptLib.js"></__script>
		</csscriptdict>
		<csactiondict>
			<__script__ type="text/javascript"><!--
CSAct[/*CMP*/ 'c417e6161'] = new Array(CSShowHide,/*CMP*/ 'ImgPro',2);
CSAct[/*CMP*/ 'c417e6262'] = new Array(CSShowHide,/*CMP*/ 'Text',2);

// --></__script>
		</csactiondict>
{/literal}

Code: Select all

<td bgcolor="white"><a onclick="CSAction(new Array(/*CMP*/'c417e6161',/*CMP*/'c417e6262'));return CSClickReturn()" [u]href="#"csclick[/u]="c417e6161,c417e6262">Klick01</a></td>
The original code which I got from Golive looked like this, but the "#" alwayes showed me the homepage, so I changed it to the code below.

Code: Select all

<td bgcolor="white"><a onclick="CSAction(new Array(/*CMP*/'c417e6161',/*CMP*/'c417e6262'));return CSClickReturn()" href=csclick="c417e6161,c417e6262">Klick01</a></td>
The problem right now is that I don't have a switching of the layers. Both layers are shown and switching together.

What is my mistake? Would be great if someone knows.

Best
kerbenok