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 Coder
    Join Date
    Jul 2011
    Posts
    52
    Thanks
    4
    Thanked 0 Times in 0 Posts

    Open/Close extra information on TD onclick

    Hello. I'm trying to open extra information if a user clicks on a TD, and close it if he click on it again. How I can do this? All I learned to do is to show it, but I can't find something that hide it if I click on the same place.

    Thanks for help.

    __________________
    הורדות
    Last edited by topdown.me; 07-02-2011 at 12:05 PM.

  • #2
    Banned
    Join Date
    Feb 2011
    Posts
    2,699
    Thanks
    13
    Thanked 395 Times in 395 Posts
    That's fairly straight forward to do. Post the code you have so far and we can try to help you get it working.

  • #3
    New Coder
    Join Date
    Jul 2011
    Posts
    52
    Thanks
    4
    Thanked 0 Times in 0 Posts
    Quote Originally Posted by bullant View Post
    That's fairly straight forward to do. Post the code you have so far and we can try to help you get it working.
    Code:
    function showdiv(luahid) { 
    if (document.getElementById) { // DOM3 = IE5, NS6 
    document.getElementById('hideshow' +id).style.display = 'block'; 
    } 
    else { 
    if (document.layers) { // Netscape 4 
    document.hideshow.display = 'block'; 
    } 
    else { // IE 4 
    document.all.hideshow.style.display = 'block'; 
    } 
    } 
    }
    I have just a div with ID, that refers to the show extra information function.
    I want when the extra informations open, to click on this div again and it will be closed.

  • #4
    Senior Coder
    Join Date
    Dec 2010
    Posts
    2,398
    Thanks
    12
    Thanked 570 Times in 563 Posts
    Wow this is ancient code

    Try this instead
    Code:
    function showDiv(id) {
       var myElement = document.getElementById('hideshow' + id);
       if(myElement.style.display=='block') {
          myElement.style.display = 'none';
       } else {
          myElement.style.display = 'block';
       }
    }

  • Users who have thanked devnull69 for this post:

    topdown.me (07-02-2011)

  • #5
    Banned
    Join Date
    Feb 2011
    Posts
    2,699
    Thanks
    13
    Thanked 395 Times in 395 Posts
    Quote Originally Posted by topdown.me View Post
    I have just a div with ID, that refers to the show extra information function.
    I want when the extra informations open, to click on this div again and it will be closed.
    I would do something along these lines:


    Code:
                
       function showHide(id) {
              var elemO = document.getElementById('hideshow' + id);
              elemO.style.display = ((elemO.style.display == 'block')? 'none' : 'block');
       }

  • Users who have thanked bullant for this post:

    topdown.me (07-02-2011)

  • #6
    New Coder
    Join Date
    Jul 2011
    Posts
    52
    Thanks
    4
    Thanked 0 Times in 0 Posts
    Love you ♥


  •  

    Posting Permissions

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