Results 1 to 5 of 5

Thread: Hide listbox with javascript??

  1. #1

    Thread Starter
    Hyperactive Member
    Join Date
    May 2000
    Location
    Kalix, Norrbotten, SWEDEN
    Posts
    343

    Hide listbox with javascript??

    How can I hide a listbox with javascript. Have tried to hide the layer that the listbox resides on. No good. The layer hides but the listbox stays visible...


    /Smirre
    Visual Basic
    C, C++
    Java
    Access
    SQL Server

    MCP, MCSD

  2. #2
    Fanatic Member punkpie_uk's Avatar
    Join Date
    Sep 2001
    Location
    UK
    Posts
    645
    Hi,

    When you said that you couldn't get the layer to disappear when you put the form element in it, I though it was a bit strange because thats the method i use.

    This code works for me...

    Code:
    <html>
    <head>
    <title>Untitled</title>
    </head>
    <body>
    <form name="form1">
      <div id="layer1">
    	  <select onmouseover="document.all('layer1').style.visibility='hidden'">
    		  <option>vfger</option>
    		  <option>vfger</option>
    		  <option>vfger</option>
    		</select>
    	</div>
    </form>
    </body>
    </html>
    SPREAD THE WORD!!! Are You Lee McCormick? Because I Am



    Lee M McCormick
    [email protected]

    Lee McCormick.com - Live
    Dynamically Webbed.com - In development but live

  3. #3
    Frenzied Member
    Join Date
    Feb 2001
    Posts
    1,140
    Have I missed something? Is document.all part of the standards?

    Code:
    document.getElementByID("layer1").style.visibility="hidden"
    Travis, Kung Foo Journeyman
    As always, RTFM.

    WWW Standards: HTML 4.01, CSS Level 2, ECMA 262 Bindings to DOM Level 1, JavaScript 1.3 Guide and Reference
    Perl: Learn Perl, Llama, Camel, Cookbook, Perl Monks, Perl Mongers, O'Reilly's Perl.com, ActiveState, CPAN, TPJ, and use Perl;
    YBMS, but Mozilla doesn't.

  4. #4
    Fanatic Member punkpie_uk's Avatar
    Join Date
    Sep 2001
    Location
    UK
    Posts
    645
    Sorry, I missed that. Yeah, it should say getElementByID. The code uses all because I use that here at work where some of the browsers are IE4
    SPREAD THE WORD!!! Are You Lee McCormick? Because I Am



    Lee M McCormick
    [email protected]

    Lee McCormick.com - Live
    Dynamically Webbed.com - In development but live

  5. #5
    Black Cat JoshT's Avatar
    Join Date
    Nov 2000
    Location
    WNY, USA
    Posts
    4,032
    "display:block" to "display:none" would also work, as "visibility:hidden" items should still take up space on the page.
    Josh
    Get these: Mozilla Opera OpenBSD
    I have books for sale: "MCSD in a Nutshell" and "VB Distributed Exam Cram" - PM me for details. Will also trade for a decent ATX Pentium 2 MB/CPU/RAM combo.

Posting Permissions

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



Click Here to Expand Forum to Full Width