|
|
|
|
![]() ![]() |
Apr 22 2007, 07:59 AM
Post
#1
|
|
|
Premium Idiot Group: [HOSTED] Posts: 661 Joined: 9-July 05 From: Switzerland, but currently in Pakistan Member No.: 6,943 |
Searching before posting my topic, i found this very helpful post.
Javascript show + hide However, I'm still muddling around trying to fine tune it, and since i'm no good at coding, I'd appreciate any help. Using that example, how do I get the div text to be hidden on loading, rather than showing it all at page load. Also, is there a way to have the text change when clicked? so that for example, it would say "expand" when it's the small amount of text, and "collapse" when it's the full text? |
|
|
|
Apr 22 2007, 08:17 AM
Post
#2
|
|
|
Nenad Bozidarevic Group: [MODERATOR] Posts: 1,049 Joined: 7-November 05 From: Belgrade, Serbia Member No.: 9,500 myCENTs:9.92 |
For the DIV you want to be hidden completely right away, use display: none in your CSS file. As for the expand/collapse like, I guess you could use something like this:
CODE <a href=..... id=operation>Collapse</a> Then, in the code that expands and collapses the DIV you should add: CODE document.getElementById("operation").innerHTML = "Expand"; This way you will change the text to "Expand" after collapsing the DIV, and the opposite when expanding it |
|
|
|
Apr 22 2007, 08:32 AM
Post
#3
|
|
|
Premium Idiot Group: [HOSTED] Posts: 661 Joined: 9-July 05 From: Switzerland, but currently in Pakistan Member No.: 6,943 |
Thank you! Problem solved!
|
|
|
|
Apr 23 2007, 05:02 AM
Post
#4
|
|
|
PsYcheDeLiC dR3aMeR Group: Admin Posts: 2,242 Joined: 29-January 05 From: Nakorn Chaisri, Thailand Member No.: 2,411 myCENTs:84.36 |
Problem solved. Topic closed
|
|
|
|
![]() ![]() |
Similar Topics
|
Lo-Fi Version | Time is now: 5th December 2008 - 01:24 AM |