Go Back   CodingForums.com > :: Client side development > JavaScript programming

Before you post, read our: Rules & Posting Guidelines

Reply
 
Thread Tools Rate Thread
Enjoy an ad free experience by logging in. Not a member yet? Register.
Old 02-01-2007, 08:21 PM   PM User | #1
poggs
New to the CF scene

 
Join Date: Feb 2007
Posts: 7
Thanks: 0
Thanked 0 Times in 0 Posts
poggs is an unknown quantity at this point
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
poggs is offline   Reply With Quote
Old 02-01-2007, 09:34 PM   PM User | #2
SocoNaTromba
New Coder

 
Join Date: Jul 2005
Posts: 12
Thanks: 0
Thanked 0 Times in 0 Posts
SocoNaTromba is an unknown quantity at this point
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 = "";
...
}
SocoNaTromba is offline   Reply With Quote
Old 02-01-2007, 11:20 PM   PM User | #3
poggs
New to the CF scene

 
Join Date: Feb 2007
Posts: 7
Thanks: 0
Thanked 0 Times in 0 Posts
poggs is an unknown quantity at this point
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.
poggs is offline   Reply With Quote
Old 02-01-2007, 11:29 PM   PM User | #4
brandonH
Regular Coder

 
Join Date: Oct 2003
Location: on a ship
Posts: 574
Thanks: 1
Thanked 6 Times in 5 Posts
brandonH is on a distinguished road
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.
brandonH is offline   Reply With Quote
Old 02-01-2007, 11:44 PM   PM User | #5
poggs
New to the CF scene

 
Join Date: Feb 2007
Posts: 7
Thanks: 0
Thanked 0 Times in 0 Posts
poggs is an unknown quantity at this point
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! )
poggs is offline   Reply With Quote
Reply

Bookmarks

Jump To Top of Thread


Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 01:02 PM.


Advertisement
Log in to turn off these ads.