SitePoint Sponsor

User Tag List

Results 1 to 3 of 3
  1. #1
    SitePoint Member
    Join Date
    Sep 2006
    Posts
    18
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Question Want to hide all forms on page.

    Complete amatuer here,

    I've been using this:

    Code:
    function openlb(div)
    {
    document.getElementById(div).style.visibility='hidden';
    }
    with this

    Code:
    <a href="#" onclick="closelb('test')">CLOSE</a></div>
    To hide a div I want to hide on click, now I'd like to hide any form on the page, or at least any select box. I've been hunting for ages now, and fiddling with code but can't get it working.

    Cheers.

  2. #2
    SitePoint Author silver trophybronze trophy

    Join Date
    Nov 2004
    Location
    Ankh-Morpork
    Posts
    12,158
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Code JavaScript:
    function hideForms() {
        var forms = document.getElementsByTagName("form");
        for (var i = 0, n = forms.length; i < n; ++i) {
            forms[i].style.visibility = "hidden";
        }
    }
    Birnam wood is come to Dunsinane

  3. #3
    SitePoint Member
    Join Date
    Sep 2006
    Posts
    18
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by AutisticCuckoo View Post
    Code JavaScript:
    function hideForms() {
        var forms = document.getElementsByTagName("form");
        for (var i = 0, n = forms.length; i < n; ++i) {
            forms[i].style.visibility = "hidden";
        }
    }
    You sir, are a legend.


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
  •