Nov 22, 2009

Javascript Show / Hide Functions - need some fine-tuning

free web hosting
Open Discussion & Free Web Hosting > Computers & Tech > Designing > Web Design and HTML

Javascript Show / Hide Functions - need some fine-tuning

Grafitti
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?

Comment/Reply (w/o sign-up)

pyost
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

Comment/Reply (w/o sign-up)

Grafitti
Thank you! Problem solved!

Comment/Reply (w/o sign-up)

miCRoSCoPiC^eaRthLinG
Problem solved. Topic closed smile.gif

Comment/Reply (w/o sign-up)


Got an Opinion! Express your Views! (no registration):-
Add your Reply/ Opinion/ Views/ Comments/ Suggestion/ Questions/ Queries etc.
Posts with decent grammar & English will be accepted and please refrain from profanities.
For asking a Question, We recommend you to sign-up (for free) so that you can track the topic easily.

Nature of your Post*: Opinion/ Reply/ Comments
Question/Query
Feedback to us.
       
Name   Email
Title/Question*

This textarea will convert to Rich-Text automatically (IE, Firefox, Chrome)

Similar Topics

Keywords : javascript, show, hide, functions, fine, tuning

  1. Javascript Problem
    (3)
  2. Xhtml, Javascript, Css And Frames.
    (0)
    Hello, I am building a form where a user selections several options (it uses javascript to modify
    checkbox values based on other selections). At the end I need to re-generate html code based on the
    selected form values, I don't particularly care what way it's done (although my site is
    XHTML 1.0 Transitional), but I need it to update on the fly as they change options. The HTML code
    is Google AdSense code, and I am trying to build my own from to generate all the different ad types
    and generate the code (it's not just for me). What kind of options do I have?....
  3. Ie Png Transparency Javascript?
    is there one? (3)
    im working on a new design for my website but i need to be able to have transparent pngs. its all
    fine in firefox and i think IE 7 it works, but IE 6, cos i no half the people that will be going on
    my site will use internet explorer 6. so basically, does anyone know any javascript that will make
    transparent PNG's work on internet explorer? id use gif but i dont just want a transparent
    background. also, id use CSS and just gifs but i need some of it to not be transparent, lol im
    fussy. so if you know anything please tell me, i gave up on javascript, its too hard. ....
  4. Can I Make A Webpage With Javascript
    title kinda says it all (9)
    ok, i plan to make a game, and i was wondering if i can make my webpage in javascript, i just
    started learning it for this massive enderour i plan to over take, and i wanted to know if it was
    possible lol. im also learning php and mysql. Thanks, Zemon1....
  5. Where To Get Chat/Guestbook/Photo Album etc. Scripts?
    javascript and flah chat , guestbook, photo album and other (4)
    Post here some links where u can download flash or javascript chat , guestbook, photoalbum, forum
    ... etc ......
  6. To Hide Your Source Code
    all you need to know to hide your source code.. (18)
    protect your source code! follow these easy 5 steps: Copied from
    http://www.cgiscript.net/cgi-script/csNews...wone&id=19&op=t QUOTE Step 1: let's assume
    your main page is named index.htm. Rename index.htm to encrypt.htm. Step 2: open encrypt.htm
    source code and add the code below to the file, right after the opening BODY tag. CODE
    m='%3Cscript%20language%3DJavaScript%3E%3C%21--%0D%0A%0D%0Avar%20message%3D%22Function%20Disable
    d%21%22%3B%0D%0A%0D%0Afunction%20clickIE%28%29%20%20%7Bif%20%28document.all%29%20%7Balert%28message%
    29%3Breturn%20false%3....
  7. JavaScript
    (1)
    Is there any place that i can get javascript from to use on my web page? Also are there any
    tutorials on how to write javascript. I have no idea how it works and would be greatful for any help
    that i can get. Thanx....
  8. Get Input From Html/txt File?
    with just html/css and maybe javascript? (2)
    I was just wondering if it's possible to retrieve text (and maybe images) from a .html or .txt
    file. So for example you get the header and footer from an external file. Is it possible with just
    html/css and maybe a little javascript or does it require server side scripting like php???
    -=jeroen=-....
  9. Hiding/showing Text On Click
    is it possible with css/javascript (2)
    Ok, I got an question: I want to make a site with a news box or something similar. It's gonna be
    a table with a small piece of text and an "read more" button. Now I want to make it so that if
    people click on the "read more" there will appear an other piece of text underneath it. How do I do
    this? thanks in advance, -=jeroen=-....
  10. Random Images On Eacht Pageload And Refresh.
    best in plain htlm or javascript (7)
    Im looking for somethin that puts a diffrent image for each pageload/refresh. And it should be
    something that dosent need any super server technolgys like php and mysql and all that stuff.
    something that is enough just on the page and finished.....
  11. Javascript Disables Css Link?
    (4)
    Here's the code I'm using for my javascript link I decided to add to a website I'm
    working on: Go Back The problem is that the css doesn't affect the javascript link. It
    displays as a plain blue underlined link. The stylesheet correctly renders regular links to other
    pages in the site, so the problem doesn't lie in my CSS coding. Thanks for the help.....
  12. What Is The Best Javascript Menu Builder?
    (7)
    I really need a free, cool and easy-to-integrate JAVASCRIPT menu builder for my new site. I mean
    free to use as in unlimitated use provided i link the producer's site to my menu. Anyway if
    someone knows anything pleas help. Thanks !!....
  13. Javascript
    Do you use javascript in your page ? (20)
    Hi , I begin to use Javascript recently. I understand very well and I'm already able to make
    little scripts. I like Javascript , it adds interactivity to the page. But sometimes , it is not so
    good ( Alerts while a page is loading ) So when do you use it , and when do you think Javascript is
    the most useful on a page. Thanks Mathieu....
  14. JavaScript template
    (1)
    to begin a javascript template, you will need to begin with this code.... Untitled
    Document ....
  15. Dynamic ASP Javascript
    (0)
    to begin a dynamic ASP Javascript you will need to begin with this code..... Untitled
    Document ....

    1. Looking for javascript, show, hide, functions, fine, tuning

See Also,

*SIMILAR VIDEOS*
Searching Video's for javascript, show, hide, functions, fine, tuning
advertisement



Javascript Show / Hide Functions - need some fine-tuning

Affordable Web Hosting, Low cost Web Hosting - ComputingHost.com