SitePoint Sponsor

User Tag List

Results 1 to 6 of 6
  1. #1
    SitePoint Zealot Wumble's Avatar
    Join Date
    Jun 2006
    Posts
    166
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    hide/show script

    http://hidemyass.com/ allows users to click "advanced options" and it displays a list of phproxy options. How would I go about doing that? Displaying/Hiding information at the click of a button?

    Thanks

    CWN

  2. #2
    SitePoint Wizard silver trophy Jelena's Avatar
    Join Date
    Feb 2005
    Location
    Universum, 3rd Corner
    Posts
    3,000
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)
    You can even take his js for that. In otherjs.js, there is a function expandcontent(curobj, cid)
    -- Jelena --

  3. #3
    SitePoint Zealot Wumble's Avatar
    Join Date
    Jun 2006
    Posts
    166
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Ah - thanks for the info

  4. #4
    SitePoint Enthusiast lucius910's Avatar
    Join Date
    Jul 2004
    Location
    Providence, RI
    Posts
    34
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    For the sake of makin it easy for those hitting this in the search, here it is.
    JS
    Code:
    function toggle(elementId)
    {
    	var elementDisplay = document.getElementById(elementId).style.display
    	if(elementDisplay=="none"){
    		show(elementId);
    	}
    	else {
    		hide(elementId);
    	}
    }
    function hide(elementId)
    {
    	document.getElementById(elementId).style.display = "block";
    }
    function show(elementId)
    {
    	document.getElementById(elementId).style.display = "none";
    }
    And th HTML
    Code:
    <a href="javascrip: toggle('box');">Advanced Options</a>
    <div id="box" style="display: none;">
      I'm hidden until you toggle me.  Toggle me again to rehide.
    </div>

  5. #5
    SitePoint Zealot Wumble's Avatar
    Join Date
    Jun 2006
    Posts
    166
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    lucius910 - thanks! That is perfect, I am going to use that. Thanks so much.

  6. #6
    Cha, Cha, Cha!!! Gamermk's Avatar
    Join Date
    Aug 2005
    Posts
    604
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by lucius910
    function toggle(elementId)
    {
    var elementDisplay = document.getElementById(elementId).style.display
    if(elementDisplay=="none"){
    show(elementId);
    }
    else {
    hide(elementId);
    }
    }
    function hide(elementId)
    {
    document.getElementById(elementId).style.display = "none";
    }
    function show(elementId)
    {
    document.getElementById(elementId).style.display = "block";
    }
    [/code]

    And th HTML
    [code]
    <a href="javascript: toggle('box');">Advanced Options</a>
    <div id="box" style="display: none;">
    I'm hidden until you toggle me. Toggle me again to rehide.
    </div>
    You mixed up the show/hide functions. Also javascript is mispelled for those you of you about to copy - paste it.
    People don't read ads. They read what interests them,
    and sometimes that happens to be an ad.
    TrulyBored.com | TankingTips.com


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
  •