Results 1 to 8 of 8

Thread: Hiding an Image..

  1. #1
    anoop007
    Guest
    How to hide an image using script?

  2. #2
    Fanatic Member Psyrus's Avatar
    Join Date
    Jul 2000
    Location
    NJ
    Posts
    602
    You can wrap your image in a <DIV></DIV> and then set the <DIV>'s visibility property to hidden.

    <script>

    div1.visibility = 'hidden';

    </script>

    <div ID = "div1">
    <img SRC = "/myimage.gif">
    </div>

    You can then display it again in script by setting the same property to 'visible'.
    Chris

    VB 6.0 Calendar App Video Gamers Group
    Don't forget to rate people if they helped you.

  3. #3
    Guest
    thanks very much...

    i didn't know the property was .visibility

    i kept trying div1.visible=false..

    Thanks a lot!

  4. #4
    Guest
    but this isn't working either

  5. #5
    Fanatic Member Psyrus's Avatar
    Join Date
    Jul 2000
    Location
    NJ
    Posts
    602
    Add this style in the document head:

    <style>

    #div1 {visibility:hidden;}

    </style>

    Give the <DIV> and ID of div1

    <div ID = "div1"><img SRC = "/myImage.gif"></div>

    That should do it.

    In order to access a style in script it must be defined in the document. Sorry, my mistake. To access this attribute from script to hide or show it you could then use this syntax:

    div1.style.visibility = 'visible';
    div1.style.visibility = 'hidden';
    Chris

    VB 6.0 Calendar App Video Gamers Group
    Don't forget to rate people if they helped you.

  6. #6
    Guest
    oh yes i figured it out later.. thanks anyway..

    I used div1.style.display = "none" .. this won't work in Netscape

    Will your code work in Netscape?

  7. #7
    Fanatic Member Psyrus's Avatar
    Join Date
    Jul 2000
    Location
    NJ
    Posts
    602
    Netscape doesn't support the ".style" in code. There is a way to access it in Netscape but I'm not totally sure of the proper syntax and I don't have it installed to test it out, sorry.
    Chris

    VB 6.0 Calendar App Video Gamers Group
    Don't forget to rate people if they helped you.

  8. #8
    Guest
    oh...

    but i have an alternative for Netscape.

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