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 5 of 5

Thread: Set Visibility

  1. #1
    New to the CF scene
    Join Date
    Feb 2007
    Posts
    7
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Set Visibility

    Hi, hope someone can help. I'm trying to change the visibility of text and an image on a gallery page. I have the following html code:

    Code:
    <img src="#" id="pic" style="visibility:hidden;" />
    <p id="temptext" style="visibility:visible;">Please click a thumbnail....</p>
    <div id="hide" style="visibility:hidden;">stuff to be hidden</div>

    And have a function which displays the correct image and hides what needs to be hidden:

    Code:
    function showPic(i,x,y) {
      ....
      document.getElementById('pic').style.visibility = "visible";
      document.getElementById('temptext').style.visibility = "hidden";
      document.getElementById('hide').style.visibility = "visible";
      ...
    }

    This works fine in FF but as per usual not in IE. I know the function is loading the image; its just not overwriting the visibility setting. I've tried adding the initial visibility style to the external style sheet instead of having it in the html code but it doesn't seem to make any difference. I've also tried setting the visibilities via an onload function, but that didn't work either! And i've tried using the display property instead of visibility.


    Please help! Thanks for reading

  • #2
    New Coder
    Join Date
    Jul 2005
    Posts
    12
    Thanks
    0
    Thanked 0 Times in 0 Posts
    try in the html:
    style="" (for the visible)
    style="display:none" (for the invisible)

    and in the java script:

    function showPic(i,x,y) {
    ....
    document.getElementById('pic').style.display = "";
    document.getElementById('temptext').style.display = "none";
    document.getElementById('hide').style.display = "";
    ...
    }

  • #3
    New to the CF scene
    Join Date
    Feb 2007
    Posts
    7
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Thank you, but it didn't work. It seemed to stop the images being loaded completely....again, just in IE7; it still works ok in FF.

  • #4
    Regular Coder
    Join Date
    Oct 2003
    Location
    on a ship
    Posts
    574
    Thanks
    1
    Thanked 6 Times in 5 Posts
    IE7 problem maybe? hve you got the newest IE7 updates?

    what you are trying has always worked in IE6 should work now to......
    I make no attempt at pretending like I'm a professional. I offer help with what knowledge I do have.

  • #5
    New to the CF scene
    Join Date
    Feb 2007
    Posts
    7
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Yep, i've recently upgraded to IE7 so it should be the most up to date version. I also have earlier versions of IE installed and it's not working on them either

    neither firefox or opera have any problem with the code...ugh i hate IE!!

    thanks for the suggestions so far (keep 'em coming! )


  •  

    Posting Permissions

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