0
votes

I have a bbcode for "spoilers" on my forum.

It shows/hides whatever text is inside the [spoiler] text [/spoiler] bbcode.

HTML replacement for this spoiler bbcode is as follows:

<div class="spoiler"><script>
function showHide(what){
a=what.getElementsByTagName("div")[0];
if(a.style.display=='none'){
a.style.display='block';
}else{
a.style.display='none';
}}
</script>
<input type="button" onclick="showHide(this.parentNode)" value="Spoiler"><b><small> ( Click to show/hide )</small></b><div style="display:none">{param}</div></div>

Where {param} is the text in between the bbcode tags.

Now, this usually works in some forums, where a person can add [center] [/center] bbcode around the spoiler bbcodes to center the spoiler button on the screen.

The [center][/center] tags have the following html:

<p style="text-align: center;"> TEXT </p>

I attempt to center the spoiler bbcode here, in my forum "signature" (under the post)

http://forums.animefushigi.com/showthread.php?2

Still it aligns left. How can I make it work? Preferably making changes to only the spoiler bbcode, as the center one is built-in.

2

2 Answers

0
votes

While not the best of solutions, if you can change the center tag code to

<center> TEXT </center>

it does fix your problem. I will edit later if I find a better solution from inside the spoiler div.

0
votes

Change

<div style="display:none">{param}</div>

To

<div style="display:none;text-align:center;">{param}</div>