I have a IPB forum v.2 and want a spoiler tag. Since I don't want to modify my IPB forum yet, I want to use custom bbcode. I've got this code, but don't have a clue of how I make a variable decide what id number every spoiler need.
code:
<script language="JavaScript" type="text/JavaScript">
<!--
function toggleVisibility(obj)
{
var Value=Math.random()*57568745757456
document
if (obj!=null)
{
if (document.getElementById)
{
var current = (document.getElementById(obj).style.display == 'block') ? 'none' : 'block';
document.getElementById(obj).style.display = current;
}
else if (document.all)
{
var current = (document.all[obj].style.display == 'block') ? 'none' : 'block'
document.all[obj].style.display = current;
}
}
}
//-->
</script>
<p>
<a href="javascript:toggleVisibility('Value')">Spoiler</a>
</p>
<div id='Value' style="display:none;">
<p style="background-color:FF0000;FONT-SIZE: 24pt;">
{content}
</p>
</div>
{content} is right, i've testen and that part works.
If I make it {option} then I can make something like this to get it work with more than one each page
code:
Spoiler for somethingunique:
What I want in spoiler
What's wrong with this solution is:
1. You have to write something unique after = in every spoler tag
2. If you quote you need to change the id of the spoiler if you don't want the second spoiler to be a remote control of the first one.
The random number don't have to be a random number multiplied with that numeber i chose there, but it needs to have many choices since i don't like remote controls.
To test if your solution works, just make a html file with two or more spoilers and check if the second one works and that it isn't a remote control.
As the code is now it should work once in each page since the id of every spoiler is value.
Thanks for every answer.