Spoiler Code for a HTML page
2 posters
Page 1 of 1
Spoiler Code for a HTML page
Hello, I am trying to create a spoiler for my HTML page. I want it to be really simple, just like FAQ page. I've been trying to search and modify the codes myself, but everything I knew about coding is long forgotten I want to have multiple of them on one page if it matters. Thanks in advance.
Last edited by Thistle on 28/1/2017, 03:27; edited 1 time in total
Re: Spoiler Code for a HTML page
Try adding this code @Thistle
You can also change where is says [Show] to a different text in that code as well.
Cheers,
James
- Code:
<a id="show_id" onclick="document.getElementById('spoiler_id').style.display=''; document.getElementById('show_id').style.display='none';" class="link">[Show]</a><span id="spoiler_id" style="display: none"><a onclick="document.getElementById('spoiler_id').style.display='none'; document.getElementById('show_id').style.display='';" class="link">[Hide]</a><br>INSERT CONTENT HERE</span>
You can also change where is says [Show] to a different text in that code as well.
Cheers,
James
Guest- Guest
Re: Spoiler Code for a HTML page
@Mimikyu, thank you! I've tried inserting two, but only one (the first one) works for me :c
Re: Spoiler Code for a HTML page
Gotcha @Thistle,
I do apologize that only 1 of those begins to work, I will take a look and give you an update as soon as I can get that fixed!
Cheers,
James
I do apologize that only 1 of those begins to work, I will take a look and give you an update as soon as I can get that fixed!
Cheers,
James
Guest- Guest
Re: Spoiler Code for a HTML page
Thank you very much! I really liked that script (http://www.bloggersentral.com/2013/03/content-spoiler-with-simple-css3.html) but I wanted the design to be very simple (just like the one you provided) and have the ability to choose names for spoilers.Mimikyu wrote:Gotcha @Thistle,
I do apologize that only 1 of those begins to work, I will take a look and give you an update as soon as I can get that fixed!
Cheers,
James
Re: Spoiler Code for a HTML page
If you are entering more than one spoiler, you will need to give each one a different ID.
Lost Founder's Password |Forum's Utilities |Report a Forum |General Rules |FAQ |Tricks & Tips
You need one post to send a PM.
You need one post to send a PM.
When your topic has been solved, ensure you mark the topic solved.
Never post your email in public.
Re: Spoiler Code for a HTML page
@SLGray, I was told that by somebody else and I cannot figure out how to do that? Can you show me if at all possible?
Guest- Guest
Re: Spoiler Code for a HTML page
Is is what the second would look like:
- Code:
<a id="show_id2" onclick="document.getElementById('spoiler_id2').style.display=''; document.getElementById('show_id2').style.display='none';" class="link">[Show]</a><span id="spoiler_id2" style="display: none"><a onclick="document.getElementById('spoiler_id2').style.display='none'; document.getElementById('show_id2').style.display='';" class="link">[Hide]</a><br>INSERT CONTENT HERE</span>
Last edited by SLGray on 27/1/2017, 00:52; edited 1 time in total
Lost Founder's Password |Forum's Utilities |Report a Forum |General Rules |FAQ |Tricks & Tips
You need one post to send a PM.
You need one post to send a PM.
When your topic has been solved, ensure you mark the topic solved.
Never post your email in public.
Re: Spoiler Code for a HTML page
SLGray wrote:id="spoiler_id"
id="spoiler_id2"
@SLGray, Thank you! I figured it out!
@Thistle, Try using the code below and seeing if it works.
- Code:
<a id="x"
onclick="document.getElementById('y').style.display='';
document.getElementById('x').style.display='none';"
class="link">
[ShowBlock1]
</a>
<span id="y" style="display: none">
<a onclick="document.getElementById('y').style.display='none';
document.getElementById('x').style.display='';"
class="link">
[Hide]
</a>
<br>
INSERT CONTENT HERE
</span>
<a id="show_id"
onclick="document.getElementById('spoiler_id').style.display='';
document.getElementById('show_id').style.display='none';"
class="link">
[ShowBlock2]
</a>
<span id="spoiler_id" style="display: none">
<a onclick="document.getElementById('spoiler_id').style.display='none';
document.getElementById('show_id').style.display='';"
class="link">
[Hide]
</a>
<br>
INSERT CONTENT HERE
</span>
Cheers,
James
Guest- Guest
Re: Spoiler Code for a HTML page
I edited my post.
Lost Founder's Password |Forum's Utilities |Report a Forum |General Rules |FAQ |Tricks & Tips
You need one post to send a PM.
You need one post to send a PM.
When your topic has been solved, ensure you mark the topic solved.
Never post your email in public.
Re: Spoiler Code for a HTML page
Problem solved & topic archived.
|
Lost Founder's Password |Forum's Utilities |Report a Forum |General Rules |FAQ |Tricks & Tips
You need one post to send a PM.
You need one post to send a PM.
When your topic has been solved, ensure you mark the topic solved.
Never post your email in public.
Similar topics
» HTML Page code on one line.
» [Help]Login Box Code for HTML page
» Code to add Chatbox on HTML page
» HTML Page Wrap Code
» When i paste a long code via [code][/code] the page expands
» [Help]Login Box Code for HTML page
» Code to add Chatbox on HTML page
» HTML Page Wrap Code
» When i paste a long code via [code][/code] the page expands
Page 1 of 1
Permissions in this forum:
You cannot reply to topics in this forum