iEntry 10th Anniversary Webforumz RegistrationAnnouncements Contact Webforumz StaffContact
Home Resources Blogs Meet the Team Contact Register
 

Go Back   WebForumz.com > The Code > JavaScript

Reply
 
LinkBack (1) Thread Tools
Old February 21st, 2006, 05:17 AM   1 links from elsewhere to this Post. Click to view. #1
WebForumz Member
 

Join Date: Feb 2004
Location: Woodbridge, UK
Age: 28
Posts: 80
Thanks: 0
Thanked 0 Times in 0 Posts
Rep Altering Power: 0 Trebz is on a distinguished road
Question Show/Hide Div Help

Hi
Does anyone have a bit of code I could borrow that will not just toggle a div on & off, but also the link that does the deed?
I want to be able to have something like...
Hide HelpText
blah blah blah blah blah blah blah blah blah
blah blah blah blah blah blah
blah blah blah"
And then when you click "Hide HelpText" it becomes
Show Help Text
Trebz is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
Old February 21st, 2006, 12:45 PM   #2
Highly Reputable Member
 
benbacardi's Avatar
 

Join Date: Feb 2004
Location: United Kingdom
Age: 21
Posts: 611
Thanks: 0
Thanked 0 Times in 0 Posts
Rep Altering Power: 0 benbacardi will become famous soon enough
Re: Show/Hide Div Help

Javascript:

Code:
function change() {

if (document.getElementById("showhide").style.display == "none") {

document.getElementById("showhide").style.display = "inline";

document.getElementById("thetext").innerHTML = "Hide Help Text";

} else {

document.getElementById("showhide").style.display = "none";

document.getElementById("thetext").innerHTML = "Show Help Text";

}

}
and the HTML:

HTML Code:
<a href="javascript:change();"><span id="thetext" style="display:inline">Show Help Text</span></a>

<div style="display:none" id="showhide">

blah blah blah blah blah blah blah blah blah
blah blah blah blah blah blah
blah blah blah

</div>
hope that helps!
benbacardi is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
Old February 21st, 2006, 06:37 PM   #3
WebForumz Member
 

Join Date: Feb 2004
Location: Woodbridge, UK
Age: 28
Posts: 80
Thanks: 0
Thanked 0 Times in 0 Posts
Rep Altering Power: 0 Trebz is on a distinguished road
Re: Show/Hide Div Help

Excellent!!!

Exactly what I needed

Thanks very much Ben, much appreciated :-D
Trebz is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
Old April 27th, 2009, 09:13 PM   #4
New Member
 

Join Date: Apr 2009
Location: Malaysia
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Rep Altering Power: 0 paulyii is on a distinguished road
Re: Show/Hide Div Help

This is wonderful !
and i have been searching around for it ..

The only problem though..
i am a GreenHorn in scripting, so i need lot of helps..

in this particuler script,
what shd i do, if there exist more than one Div i wanna "show/Hide" ??

i'd tried rename the Second Div, but .. when i clicked my " show Text"
both links were effected.

My page shd look like this :

1. Transport : [ Show Detail}
Code:
This is what we saw when clicked [show Detail]
* Taxi
* Bus
* Ship
2. Races [ Show Detail]
Code:
This is what we saw when clicked [show Detail]
* English
* Chinese
* Indian
paulyii is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
Reply

Bookmarks

Tags
showhide , div , help


LinkBacks (?)
LinkBack to this Thread: http://webforumz.com/javascript/5400-show-hide-div-help.htm
Posted By For Type Date
html help div This thread Refback September 11th, 2006 03:17 PM

Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Similar Threads
Thread Thread Starter Forum Replies Last Post
Show/hide/add textfields from dropdownmenu UD2006 JavaScript 0 April 9th, 2008 04:36 AM
CSS Show Hide with JS abis123 JavaScript 4 December 13th, 2007 01:39 AM
[SOLVED] Show&amp;Hide Div Box Maska JavaScript 6 October 1st, 2007 07:04 AM
Show/Hide JS pa007 JavaScript 0 April 6th, 2007 03:18 PM
Show and Hide Text - how do I do that? Love2Java JavaScript 1 March 28th, 2007 08:23 PM


Search Engine Optimization by vBSEO 3.2.0 RC8