Results 1 to 3 of 3

Thread: The (sliding) hidden and open text box

  1. #1
    Join Date
    Jan 2007
    Posts
    18
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Unhappy The (sliding) hidden and open text box

    Hi All,

    I just have a little question to ask.

    I wonder how to do the sliding hidden and open text box like:

    If you go to Youtube.com and look at the forum board, when you click on "Post text comment" or "reply" or "discard", there shows a textbox or close a textbox without having to load another page.

    I have been trying many ways such as CSS and some javascript but the results were not good enough

    I'm not sure if this Javascript or DHTML or other?

    Please anyone let me know, and if you know a good open source to be suggested, that would be very thankfull

    Many Thanks!

    Chad


    P.S I'm not sure if I'm posting this at the right forum (as I dont know what the technich is), if wrong, I'm sorry, please also let me know, thanks.

  2. #2
    Join Date
    Jul 2006
    Location
    Canada
    Posts
    2,581
    Thanks
    13
    Thanked 28 Times in 28 Posts

    Default

    Code:
    <script type="text/javascript">
    function display(id) {
    var obj = document.getElementById(id)
    if (obj.style.display == "none") {
    	obj.style.display = "block"
    	}
    else {
    	obj.style.display = "none"
    	}
    return false
    }
    </script>
    And use it on any two objects.
    For example:
    Code:
    <input type="button" value="Show/Hide" onclick="display('box1')">
    <br><div id="box1" style="padding:2px;border:1px solid black;display:none">Text to be displayed</div>
    - Mike

  3. #3
    Join Date
    Jan 2007
    Posts
    18
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    Thanks mburt. it works!

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
  •