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 3 of 3
  1. #1
    New Coder
    Join Date
    Jul 2004
    Location
    Bombay, India
    Posts
    10
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Simple Drop Down (Help)

    This the entire HTML code

    <html>
    <head>
    <title></title>
    <style>
    #doors{
    position:absolute;
    top:100px;
    visibility:hidden;
    }
    </style>

    <script>

    function hide(){
    doors.style.visiblity="visible";
    doors.style.top=200;
    }

    </script>

    </head>



    <body text="#ffffff" bgcolor="#000000">

    <a href="#" onMouseOver="(hide());return false"><img src="pink.gif"></a><br>

    <div id="doors">
    <img src="doors.gif">
    </div>

    </body>

    </html>


    =========================================================
    Can't get the image(id="doors") to change its visiblity. Feeling really stupid and frustrated as I get this this seemingly simple code to work. Other style properties like positioning are working. Its just that I can't get the visiblity property to change. I think I may be missing something really obvious here; or maybe not. I would really appreciate any help. Thanks in advance.

  • #2
    Smokes a Lot
    Join Date
    Jul 2003
    Location
    CA, USA
    Posts
    1,594
    Thanks
    5
    Thanked 20 Times in 20 Posts
    Not really sure what you are trying to do here, you have doors set to hidden onload then you call the function hide() to make it visible? Just add document.getElementById when referencing the div.

    EX.
    Code:
    <html>
    <head>
    <title></title>
    <style>
    #doors{
    position:absolute;
    top:100px;
    visibility:hidden;
    }
    </style>
    
    <script>
    
    function hide(){ 
    document.getElementById('doors').style.visibility="visible";
    document.getElementById('doors').style.top=200; 
    }
    
    </script>
    
    </head>
    
    
    
    <body text="#ffffff" bgcolor="#000000">
    
    <a href="#" onMouseOver="(hide());return false"><img src="pink.gif"></a><br>
    
    <div id="doors">
    <img src="top_curve.jpg">
    </div>
    
    </body>
    
    </html>
    Basscyst
    Helping to build a bigger box. - Adam Matthews

  • #3
    New Coder
    Join Date
    Jul 2004
    Location
    Bombay, India
    Posts
    10
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Well I am working on getting the image visiblity to toggle with the function. I know that the function name and its purpose don't match. It started out as a function that hides images, but later when it didnot work I switched it. I am sorry I should have corrected that before posting. Anyways, thanks a lot for the help; the function getElementByID() worked.


  •  

    Posting Permissions

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