[Typo3-dev] Replacing <tr> id's to something dynamic using typoscript?

Elijah Alcantara elijah.alcantara at gmail.com
Thu Dec 8 07:58:56 CET 2005


I've created this little textbox that has a button that sort of
'toggles' the row below it ... so as to hide/show some text whenever
it's clicked:

[CODE]
<head>
 <script>
 function toggle(id) {
	var hidethis = document.getElementById(id);
 	if( hidethis.style.display== 'none' ){
		hidethis.style.display = '';
 	}
 	else{
		hidethis.style.display = 'none';
	}
}
</script>
</head>
<body>
<table border="0" cellpadding="0" cellspacing="0">
	<tr>
		<td></td>
		<td> ... etc etc
                ...
		<td> ... <img alt="" src="images/button.jpg"
onclick="javascript:toggle('hidethis')" ></td>
	</tr>
	<tr id="hidethis">
		<td> ... etc....
		</td>
	</tr>
</table>
</body>
[/CODE]

This templavoila'd flexible content works wonderfully on my page ...
but the problem part comes when there are multiple instances of this
on a single page (they all have the same id's!)... when you click on
the button it only toggles the first dropdown box ... the rest are
quiet and sits there doing nothing.

I figure if I somehow make the id's called 'hidethis' to something
like uid's of each text content they contain (tt_content), the
succeeding dropdown text boxes may work:

onclick="javascript:toggle(some_dynamic_tt_content_uid)"
	<tr id="some_dynamic_tt_content_uid">


Someone suggested to create another data element for my template and
map it to my javascript & <tr id=""> ... then create something like
this on our typoscript setup:

lib.toggle = TEXT
lib.toggle.??? = ????
lib.toggle.wrap = please do something dynamic! |


But I'm stuck! all I know to get the uid of a particular text content
is like this:
lib.toggle.data = DB : tt_content : 255 : uid
It's not as dynamic cause I'm giving away the uid 255 of that text element ...

=( anyone done this before?



Elijah A.




More information about the TYPO3-dev mailing list