4 Replies - 36844 Views - Last Post: 21 November 2007 - 03:30 PM

#1 Dusty84  Icon User is offline

  • New D.I.C Head

Reputation: 1
  • View blog
  • Posts: 3
  • Joined: 16-April 07

Simple Show/Hide Text Button for Forum

Posted 16 April 2007 - 10:55 PM

Hi, my name is Dusty! This looks like one of the better sites so far for HTML help so I'm giving you a try. First of all I'll explain what I'm trying to do. I want a simple html code that will show or hide text when a button is clicked. I would use this code in the BBCode manager of my forum to create a tag such as [showhide] that members could use. I have searched all over the web and can't find the simple answer I'm looking for in html! All I find are much more complex Q&A's. I don't want a text box, or anything fancy, just a button to show or hide the text in the post. I imagine, as I'm not an expert, but more of a beginner, that the code would take the form of:
<whatever the show/hide command is>{here's where the text goes}</whatever the show/hide command is>
I hope I explained this well enough for someone to make me look like a genious on the forum, in fact I would gladly share the credit and throw some kudos to anyone with a successful solution!

Is This A Good Question/Topic? 0
  • +

Replies To: Simple Show/Hide Text Button for Forum

#2 DilutedImage  Icon User is offline

  • D.I.C Addict
  • member icon

Reputation: 14
  • View blog
  • Posts: 646
  • Joined: 20-November 06

Re: Simple Show/Hide Text Button for Forum

Posted 17 April 2007 - 05:04 PM

View PostDusty84, on 16 Apr, 2007 - 10:55 PM, said:

This looks like one of the better sites so far for HTML help so I'm giving you a try.

Thank you; we're honored that you've been so kind as to allow us the opportunity to help you.

View PostDusty84, on 16 Apr, 2007 - 10:55 PM, said:

I would gladly share the credit and throw some kudos to anyone with a successful solution!


Really? You'd share the credit for your great accomplishment of receiving an answer!? You are far too generous ...

. . .

Really though, you're not going to accomplish that with HTML. There is no magic tag that hides/shows the contents when clicked. Enclose the content in span/div/etc.. tag, and then use Javascript to change it's visibility attribute.

2


And heres' TONS OF SAMPLE CODE

This post has been edited by DilutedImage: 17 April 2007 - 05:04 PM

Was This Post Helpful? 0
  • +
  • -

#3 Dusty84  Icon User is offline

  • New D.I.C Head

Reputation: 1
  • View blog
  • Posts: 3
  • Joined: 16-April 07

Re: Simple Show/Hide Text Button for Forum

Posted 18 April 2007 - 02:50 PM

Thanks very much! I found and used this:

<body>
<script type="text/javascript">
<!--
function toggle_visibility(id) {
var e = document.getElementById(id);
if(e.style.display == 'none')
e.style.display = 'block';
else
e.style.display = 'none';
}
//-->
</script>
<a onclick="toggle_visibility('foo');"><b><u>Click to 

view</b></u></a><div id="foo" style=display:none;>{param}</div>
</body>




Despite the sarcasm, which I suppose I deserved, you were quite helpful :)
Was This Post Helpful? 1

#4 DilutedImage  Icon User is offline

  • D.I.C Addict
  • member icon

Reputation: 14
  • View blog
  • Posts: 646
  • Joined: 20-November 06

Re: Simple Show/Hide Text Button for Forum

Posted 19 April 2007 - 01:59 AM

I do what I can. :D

And yes, I'm a bit sarcastic sometimes, and I just couldn't resist it on this one. .. No worries though, you didn't do anything to deserve it; it was free of charge.
Was This Post Helpful? 0
  • +
  • -

#5 YellowJello  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 1
  • Joined: 21-November 07

Re: Simple Show/Hide Text Button for Forum

Posted 21 November 2007 - 03:30 PM

I apologize for bumping this thread after it has been dead for so long, but is there any way to make a button like that with HTML, PHP, or even BBcode (those are the only types accepted on those forums)? The forums that I normally post on do have javascript activated but this code still does not work. Any help will be greatly appreciated.

Also, just in case what I'm asking for is slightly different from what Dusty84 wanted, here's the javascript version of what I want:

<a href="java script:;" id="dw3_list" onclick="ShowDivRemote('dw3_list','hide_dw3_list','Show Lists...','Hide Lists...')">Hide Lists...</a></b><div style="display: block;" id="dw3_lists">
TEXT HERE
</div></div>


As I've already said before, this is not for the website itself, it's for just a post; so I can't set up any custom script or whatever it's called.

This post has been edited by YellowJello: 21 November 2007 - 06:56 PM

Was This Post Helpful? 0
  • +
  • -

Page 1 of 1