Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 6 of 6
  1. #1
    New to the CF scene
    Join Date
    Jul 2002
    Location
    Seattle
    Posts
    3
    Thanks
    0
    Thanked 0 Times in 0 Posts

    DHTML text displacement

    Is there a way to make a hidden DIV displace text when it is made visible?

    I want to make a page, a huge form really, with a several hidden sections, structured like this:

    [main form]
    [optional info 1]
    [optional info 2]
    [optional info 3]
    [additional info]
    [submit button]

    Each of the optional info's is contained in a DIV which is initially hidden, and which can be made visible with a "MORE>>" type javascript button located just before each DIV.

    I'd like to be able to hit the "MORE>>" button, and have all of the content below that button slide down the page to make room for the newly revealed DIV (rather than have a big blank spot, or have overlapping content). Is there any way to do this?

    Thanks!

  • #2
    Regular Coder
    Join Date
    Jun 2002
    Location
    The Netherlands
    Posts
    217
    Thanks
    0
    Thanked 0 Times in 0 Posts
    You have to set the Display of the DIV to None,like this:
    Code:
    var x=document.getElementById("div_id");
    x.style.display="none";
    Then to show it ,set Display to nothing:

    Code:
    var x=document.getElementById("div_id");
    x.style.display="";

  • #3
    New to the CF scene
    Join Date
    Jul 2002
    Location
    Seattle
    Posts
    3
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Wonderful! That's just what I'm looking for.

    One thing, though: does it only work in IE? If so, are there other solutions for Netscape/Moz users?

    Thanks!

  • #4
    Regular Coder
    Join Date
    Jun 2002
    Posts
    185
    Thanks
    0
    Thanked 0 Times in 0 Posts
    It will work on any browser that supports the CSS display property - that includes Netscape 6+ and Mozilla.

    If your script doesn't work with those browser, check your code for IE-proprietary statements like "document.all".

  • #5
    Regular Coder
    Join Date
    Jun 2002
    Location
    The Netherlands
    Posts
    217
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Originally posted by BrainJar
    It will work on any browser that supports the CSS display property - that includes Netscape 6+ and Mozilla.

    If your script doesn't work with those browser, check your code for IE-proprietary statements like "document.all".
    Initially setting the display property works in all browsers,but dynamically changing it doesn't work in Opera (as far as I know).It will work with NS6+/Mozilla and Konqueror

  • #6
    New to the CF scene
    Join Date
    Jul 2002
    Location
    Seattle
    Posts
    3
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Worked like a charm

    That works great! Thanks everybody!


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •