The forum of the forums

Would you like to react to this message? Create an account in a few clicks or log in to continue.
The forum of the forums
5 posters

    How to make show&Hide button like this

    MassKilling
    MassKilling
    Forumember


    Male Posts : 33
    Reputation : 2
    Language : Indonesia
    Location : Indonesia

    Solved How to make show&Hide button like this

    Post by MassKilling July 22nd 2012, 8:44 am

    How to make show&Hide button like this Aaa10
    How to make show&Hide button like this Aaa11
    Give me the code please Very Happy

    my forum is PHPbb2
    *sorry for my bad english


    Last edited by MassKilling on July 29th 2012, 4:03 am; edited 2 times in total
    MassKilling
    MassKilling
    Forumember


    Male Posts : 33
    Reputation : 2
    Language : Indonesia
    Location : Indonesia

    Solved Re: How to make show&Hide button like this

    Post by MassKilling July 26th 2012, 10:34 am

    bump
    avatar
    nathanadhitya
    Forumember


    Male Posts : 98
    Reputation : 2
    Language : English And Indonesia

    Solved Re: How to make show&Hide button like this

    Post by nathanadhitya July 26th 2012, 12:09 pm

    Hey youre from indonesia lol mee too and halo MassKilling
    and it's type of toggle and the problem for your forum must be PunBB And Phpbb2
    lilyheart7
    lilyheart7
    Forumember


    Posts : 40
    Reputation : 7
    Language : English

    Solved Re: How to make show&Hide button like this

    Post by lilyheart7 July 26th 2012, 12:52 pm

    That is not very hard to do, actually.

    I believe that is the Homepage Message, so you'd need to put the following code (after edited) in that.
    Code:
    <style type="text/css">
    div {
    position: absolute;
    left: 0px;
    top: 29px;
    width: 280px;
    padding: 10px;
    color: black;
    border: none;
    display: none;
    }
    </style>
     
     
    <script language="JavaScript">
    function setVisibility(id) {
    if(document.getElementById('bt1').value=='Hide'){
    document.getElementById('bt1').value = 'Title Here';
    document.getElementById(id).style.display = 'none';
    }else{
    document.getElementById('bt1').value = 'Hide';
    document.getElementById(id).style.display = 'inline';
    }
    }
     
    </script>

    <input type=button name=type id='bt1' value='Title Here' onclick="setVisibility('sub3');";>
     
    <div id="sub3">Your HTML/Text Here
    </div>

    So where it says "Title Here" you put the title of your content or something along the lines of "Show Content" and for "Your HTML/Text Here", you put your HTML or Text or etc. You can change "Hide" as well.

    I hope this is what you're looking for.
    MassKilling
    MassKilling
    Forumember


    Male Posts : 33
    Reputation : 2
    Language : Indonesia
    Location : Indonesia

    Solved Re: How to make show&Hide button like this

    Post by MassKilling July 27th 2012, 9:44 am

    it doesn't work
    if i copy that code in my homepage message
    my forum is blank

    *sorry for my bad english
    lilyheart7
    lilyheart7
    Forumember


    Posts : 40
    Reputation : 7
    Language : English

    Solved Re: How to make show&Hide button like this

    Post by lilyheart7 July 27th 2012, 11:37 am

    Oh! I'm so sorry, the code should be:
    Code:
    <style type="text/css">
    div#sub3 {
    position: absolute;
    left: 0px;
    top: 29px;
    width: 280px;
    padding: 10px;
    color: black;
    border: none;
    display: none;
    }
    </style>
     
     
    <script language="JavaScript">
    function setVisibility(id) {
    if(document.getElementById('bt1').value=='Hide'){
    document.getElementById('bt1').value = 'Title Here';
    document.getElementById(id).style.display = 'none';
    }else{
    document.getElementById('bt1').value = 'Hide';
    document.getElementById(id).style.display = 'inline';
    }
    }
     
    </script>

    <input type=button name=type id='bt1' value='Title Here' onclick="setVisibility('sub3');";>
     
    <div id="sub3">Your HTML/Text Here
    </div>

    Sorry, I forgot to put the #sub3 on the div.
    MassKilling
    MassKilling
    Forumember


    Male Posts : 33
    Reputation : 2
    Language : Indonesia
    Location : Indonesia

    Solved Re: How to make show&Hide button like this

    Post by MassKilling July 28th 2012, 7:28 am

    lilyheart7 wrote:Oh! I'm so sorry, the code should be:
    Code:
    <style type="text/css">
    div#sub3 {
    position: absolute;
    left: 0px;
    top: 29px;
    width: 280px;
    padding: 10px;
    color: black;
    border: none;
    display: none;
    }
    </style>
     
     
    <script language="JavaScript">
    function setVisibility(id) {
    if(document.getElementById('bt1').value=='Hide'){
    document.getElementById('bt1').value = 'Title Here';
    document.getElementById(id).style.display = 'none';
    }else{
    document.getElementById('bt1').value = 'Hide';
    document.getElementById(id).style.display = 'inline';
    }
    }
     
    </script>

    <input type=button name=type id='bt1' value='Title Here' onclick="setVisibility('sub3');";>
     
    <div id="sub3">Your HTML/Text Here
    </div>

    Sorry, I forgot to put the #sub3 on the div.
    if i put the code to my homepage message,
    the result is
    result:
    Rideem3 wrote:Put this in an announcement or wherever you want the toggling to occur:
    Code:
    <div id="toggle_ele">Your content here</div>
    <input type="button" onClick="toggleEle('toggle_ele');" value="Toggle" />
    <script type="text/javascript">
    function toggleEle(id) {
    if (document.getElementById(id).style.display != "none") document.getElementById(id).style.display = "none";
    else (document.getElementById(id).style.display = "block";
    }
    </script>
    it doesn't work
    my content doesn't appear Sad


    How to make show&Hide button like this Plus_16 to you for trying to help me Very Happy
    *sorry for my bad english Very Happy
    lilyheart7
    lilyheart7
    Forumember


    Posts : 40
    Reputation : 7
    Language : English

    Solved Re: How to make show&Hide button like this

    Post by lilyheart7 July 28th 2012, 2:28 pm

    Try this one:
    Code:
    <style type="text/css">
    div#sub3 {
    position: absolute;
    left: 0px;
    top: auto;
    padding: 20px;
    color: black;
    border: none;
    display: none;
    }
    </style>
     
     
    <script language="JavaScript">
    function setVisibility(id) {
    if(document.getElementById('bt1').value=='Hide'){
    document.getElementById('bt1').value = 'Title Here';
    document.getElementById(id).style.display = 'none';
    }else{
    document.getElementById('bt1').value = 'Hide';
    document.getElementById(id).style.display = 'inline';
    }
    }
     
    </script>

    <input type=button name=type id='bt1' value='Title Here' onclick="setVisibility('sub3');";>
     
    <div id="sub3">Your HTML/Text Here
    </div><
    Sanket
    Sanket
    ForumGuru


    Male Posts : 48766
    Reputation : 2830
    Language : English
    Location : Mumbai

    Solved Re: How to make show&Hide button like this

    Post by Sanket July 28th 2012, 2:52 pm

    MassKilling
    MassKilling
    Forumember


    Male Posts : 33
    Reputation : 2
    Language : Indonesia
    Location : Indonesia

    Solved Re: How to make show&Hide button like this

    Post by MassKilling July 29th 2012, 4:04 am

    Thank you Sanket Very Happy
    Solved.
    ankillien
    ankillien
    Energetic


    Posts : 5198
    Reputation : 129
    Language : English, XHTML, CSS, JS, PHP, SQL

    Solved Re: How to make show&Hide button like this

    Post by ankillien July 29th 2012, 4:05 am

    Topic Solved & Locked

      Current date/time is November 11th 2024, 10:17 pm