中心 DIV 为 BBcode
我的论坛上有一个“剧透”的 bbcode。
它显示/隐藏 [spoiler] 文本 [/spoiler] bbcode 中的任何文本。
此剧透 bbcode 的 HTML 替换如下:
<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>
其中 {param} 是 bbcode 标记之间的文本。
现在,这通常在某些论坛中起作用,人们可以在剧透 bbcode 周围添加 [center] [/center] bbcode,以使剧透按钮在屏幕上居中。
[center][/center] 标签具有以下 html:
<p style="text-align: center;"> TEXT </p>
我尝试将剧透 bbcode 置于此处,在我的论坛“签名”(在帖子下)
http://forums.animefushigi.com/showthread.php?2
仍然左对齐。我怎样才能让它发挥作用?最好只更改剧透 bbcode,因为中间的 bbcode 是内置的。
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.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
虽然不是最好的解决方案,但如果您可以更改中心标签代码,
它确实可以解决您的问题。如果我从扰流板 div 中找到更好的解决方案,我会稍后进行编辑。
While not the best of solutions, if you can change the center tag code to
it does fix your problem. I will edit later if I find a better solution from inside the spoiler div.
更改
为
Change
To