SitePoint Sponsor

User Tag List

Page 1 of 2 12 LastLast
Results 1 to 25 of 29
  1. #1
    SitePoint Evangelist
    Join Date
    Jan 2002
    Posts
    420
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Collapse Thread - How to accomplish?

    I am wondering how I would make the [-] Button that collapses/expands a thread here on the forums. (I hope you know what I mean, its tough to explain)

    I am going to have a page with multiple entries using XML and would like to be able to have the title of an entry showing and then you can press on the expand button to view further details.

    Can this be done with JavaScript or DHTML?

    Hey wait a sec, its gone. Where did it go?
    Wavelan

  2. #2
    Perl/Mason Guru Flawless_koder's Avatar
    Join Date
    Feb 2002
    Location
    Gatwick, UK
    Posts
    1,206
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    ---=| If you're going to buy a pet - get a Shetland Giraffe |=---

  3. #3
    SitePoint Evangelist compwizard's Avatar
    Join Date
    May 2002
    Location
    United States
    Posts
    457
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    you could adapt code from this tutorial:

    http://hotwired.lycos.com/webmonkey/...l?tw=authoring
    Compwizard
    "There are 10 kinds of people in this world -- those who know binary, and those who don't."

  4. #4
    Currently Occupied; Till Sunda Andrew-J2000's Avatar
    Join Date
    Aug 2001
    Location
    London
    Posts
    2,475
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I prefer this method tho as it will collapse the next Sibling or Node using the DOM.

    this.nextSibling.style.display='block'
    this.nextSibling.style.display='none'

    ie

    PHP Code:
    <script type="text/javascript">
    function 
    show_hide(what)
    {
      var 
    check what.nextSibling;
      if (
    check)
      {
        (
    check.style.display == 'none')? check.style.display 'block' check.style.display 'none';
      }
    }
    </script>

    <table>
      <tr onclick="show_hide(this)">
        <td>a</td>
      </tr>
      <tr>
        <td>a</td>
      </tr>
    </table> 

  5. #5
    Perl/Mason Guru Flawless_koder's Avatar
    Join Date
    Feb 2002
    Location
    Gatwick, UK
    Posts
    1,206
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Andrew - HUH mate?!?!?

    Did you not look at the thread i posted?!

    this.nextSibling.style.display=(this.nextSibling.style.display=='')?'none':'';

    dopey - You not awake yet.

    Speak to you soon mate

    Flawless
    ---=| If you're going to buy a pet - get a Shetland Giraffe |=---

  6. #6
    Web-coding NINJA! silver trophy beetle's Avatar
    Join Date
    Jul 2002
    Location
    Dallas, TX
    Posts
    2,900
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Well, I'm sure you'd rather do it yourself than pay for something, but here's a cool link ne wayz.

    http://www.cirkadia.com/iNavigateProductOverview.html
    beetle a.k.a. Peter Bailey
    blogs: php | prophp | security | design | zen | software
    refs: dhtml | gecko | prototype | phpdocs | unicode | charsets
    tools: ide | ftp | regex | ffdev




  7. #7
    Perl/Mason Guru Flawless_koder's Avatar
    Join Date
    Feb 2002
    Location
    Gatwick, UK
    Posts
    1,206
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Pay for something you can do for free ...
    Like I'm going to do THAT!

    Good idea though...

    *rubs his hands together cunningly*

    ... maybe i could sell ... ummm.... WATER!
    .. a HA - i could make a fortune...


    * eyes slowly settle on a bottle of Volvic sitting on a nearby desk *

    DOH!



    Flawless
    ---=| If you're going to buy a pet - get a Shetland Giraffe |=---

  8. #8
    Web-coding NINJA! silver trophy beetle's Avatar
    Join Date
    Jul 2002
    Location
    Dallas, TX
    Posts
    2,900
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Step right up folks!

    "Here's our brand new consumption product, NitroOxy2"

    "So clean, so fresh, you'll begin to realize you can't live without it!"

    "And at $20 per cubic foot, you can't afford not to!"

    "Shop online at www.uGOTripped.com"

    beetle a.k.a. Peter Bailey
    blogs: php | prophp | security | design | zen | software
    refs: dhtml | gecko | prototype | phpdocs | unicode | charsets
    tools: ide | ftp | regex | ffdev




  9. #9
    Perl/Mason Guru Flawless_koder's Avatar
    Join Date
    Feb 2002
    Location
    Gatwick, UK
    Posts
    1,206
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)


    What's your location Beetle - it's not in your profile.

    just curious - i like to know where people are from
    when i end up in the same forum as them.

    Flawless
    ---=| If you're going to buy a pet - get a Shetland Giraffe |=---

  10. #10
    SitePoint Evangelist
    Join Date
    Jan 2002
    Posts
    420
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Thanks for the help guys it worked perfectly

    Is there a way to make it so the row is defaulted to a collapsed state?
    Wavelan

  11. #11
    Perl/Mason Guru Flawless_koder's Avatar
    Join Date
    Feb 2002
    Location
    Gatwick, UK
    Posts
    1,206
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    put style="display:none" in the td

    Flawless
    ---=| If you're going to buy a pet - get a Shetland Giraffe |=---

  12. #12
    SitePoint Evangelist
    Join Date
    Jan 2002
    Posts
    420
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    didnt work in the TD but when I put it in the TR it worked

    Thankyou very much
    Wavelan

  13. #13
    Perl/Mason Guru Flawless_koder's Avatar
    Join Date
    Feb 2002
    Location
    Gatwick, UK
    Posts
    1,206
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    what browser version and name?

    Flawless
    ---=| If you're going to buy a pet - get a Shetland Giraffe |=---

  14. #14
    Currently Occupied; Till Sunda Andrew-J2000's Avatar
    Join Date
    Aug 2001
    Location
    London
    Posts
    2,475
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    hehe sry never checked your link mate lol...

    Even tho i do need some of the good old NitroOxy2 lol

  15. #15
    Perl/Mason Guru Flawless_koder's Avatar
    Join Date
    Feb 2002
    Location
    Gatwick, UK
    Posts
    1,206
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Talking of Nitro (though not the same type)...
    A friend of mine just cleared one of the largest
    bottles of NoS out in ... ummm ... a WEEK, in a mini.
    He's the only person i know that would ever go round
    roundabouts with his thumb on the Nitrous button

    Flawless
    ---=| If you're going to buy a pet - get a Shetland Giraffe |=---

  16. #16
    Currently Occupied; Till Sunda Andrew-J2000's Avatar
    Join Date
    Aug 2001
    Location
    London
    Posts
    2,475
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    btw what happens to you code if the nextSibling dont exist btw

    PHP Code:
    this.nextSibling.style.display=(this.nextSibling.style.display=='')?'none':''

  17. #17
    Perl/Mason Guru Flawless_koder's Avatar
    Join Date
    Feb 2002
    Location
    Gatwick, UK
    Posts
    1,206
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Then the object would fall over on reference.
    I can't see how that would happen unless you go removing
    objects randomly with removeChild or something.

    and btw - use CODE rather than PHP - otherwise you'll
    confuzzle me mate

    Flawless
    ---=| If you're going to buy a pet - get a Shetland Giraffe |=---

  18. #18
    Currently Occupied; Till Sunda Andrew-J2000's Avatar
    Join Date
    Aug 2001
    Location
    London
    Posts
    2,475
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    hehe, enough people have said that, but i like the colours

  19. #19
    The doctor is in... silver trophy MarcusJT's Avatar
    Join Date
    Jan 2002
    Location
    London
    Posts
    3,509
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Off topic, but if you look at the starting post in this thread (by Wavelan), you'll notice this at the bottom:

    Last edited by Wavelan on 12-Jul-1929 at 11:31 PM
    WTF?
    MarcusJT
    - former ASP web developer / former SPF "ASP Guru"
    - *very* old blog with some useful ASP code

    - Please think, Google, and search these forums before posting!

  20. #20
    Perl/Mason Guru Flawless_koder's Avatar
    Join Date
    Feb 2002
    Location
    Gatwick, UK
    Posts
    1,206
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    My GOD - He's got a time machine !

    ( and strangely enough - the internet - wherever he's
    going to! )



    Flawless
    ---=| If you're going to buy a pet - get a Shetland Giraffe |=---

  21. #21
    SitePoint Evangelist
    Join Date
    Jan 2002
    Posts
    420
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Yah, well us Canadians have always been ahead of everyone else
    Wavelan

  22. #22
    The doctor is in... silver trophy MarcusJT's Avatar
    Join Date
    Jan 2002
    Location
    London
    Posts
    3,509
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I (and others) appear to have been a bit slow - Wavelan clearly has that line as part of his signature!!! lol!

    Wavelan, you got me!
    MarcusJT
    - former ASP web developer / former SPF "ASP Guru"
    - *very* old blog with some useful ASP code

    - Please think, Google, and search these forums before posting!

  23. #23
    Perl/Mason Guru Flawless_koder's Avatar
    Join Date
    Feb 2002
    Location
    Gatwick, UK
    Posts
    1,206
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    .oO( he's planning his revenge already )

    Marco - you'll like the dhtml post - i think ... on multi-dimensional arrays.

    Flawless
    ---=| If you're going to buy a pet - get a Shetland Giraffe |=---

  24. #24
    Currently Occupied; Till Sunda Andrew-J2000's Avatar
    Join Date
    Aug 2001
    Location
    London
    Posts
    2,475
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    flawless i know your prouda that one

  25. #25
    The doctor is in... silver trophy MarcusJT's Avatar
    Join Date
    Jan 2002
    Location
    London
    Posts
    3,509
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Checked it out....!
    MarcusJT
    - former ASP web developer / former SPF "ASP Guru"
    - *very* old blog with some useful ASP code

    - Please think, Google, and search these forums before posting!


Bookmarks

Posting Permissions

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