Welcome Guest ( Log In | Register )



 
Closed TopicStart new topic
> Javascript Show / Hide Functions, need some fine-tuning
Grafitti
post Apr 22 2007, 07:59 AM
Post #1


Premium Idiot
Group Icon

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?
Go to the top of the page
 
+Quote Post
pyost
post Apr 22 2007, 08:17 AM
Post #2


Nenad Bozidarevic
Group Icon

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 smile.gif
Go to the top of the page
 
+Quote Post
Grafitti
post Apr 22 2007, 08:32 AM
Post #3


Premium Idiot
Group Icon

Group: [HOSTED]
Posts: 661
Joined: 9-July 05
From: Switzerland, but currently in Pakistan
Member No.: 6,943



Thank you! Problem solved!
Go to the top of the page
 
+Quote Post
miCRoSCoPiC^eaRt...
post Apr 23 2007, 05:02 AM
Post #4


PsYcheDeLiC dR3aMeR
Group Icon

Group: Admin
Posts: 2,242
Joined: 29-January 05
From: Nakorn Chaisri, Thailand
Member No.: 2,411
myCENTs:84.36



Problem solved. Topic closed smile.gif
Go to the top of the page
 
+Quote Post

Closed TopicStart new topic

Collapse

> Similar Topics

Topics Topics
  1. Javascript(20)
  2. What Is The Best Javascript Menu Builder?(7)
  3. Javascript Disables Css Link?(4)
  4. Random Images On Eacht Pageload And Refresh.(6)
  5. Hiding/showing Text On Click(2)
  6. Get Input From Html/txt File?(2)
  7. JavaScript(1)
  8. To Hide Your Source Code(13)
  9. Where To Get Chat/Guestbook/Photo Album etc. Scripts?(4)
  10. Can I Make A Webpage With Javascript(9)
  11. Ie Png Transparency Javascript?(3)
  12. Xhtml, Javascript, Css And Frames.(0)
  13. Javascript Problem(3)


 



- Lo-Fi Version Time is now: 5th December 2008 - 01:24 AM