Click to See Complete Forum and Search --> : Problem displaying pictures when using javascript on an apple.


redpi
05-16-2003, 01:16 AM
I have the following problem:

Ik have a page with a 'next' and 'previous' button. In that page there's a inline frame with a simple page that displays one photo. When you click the 'next' or 'previous' button, the 'nextphoto', resp. 'previousphoto' function of the page in the frame is called. These functions are pretty straightforward:


<script language="JavaScript">
var n;
n=1;

function nextphoto(){
if(n < 14){
n += 1;}
else{
n = 1;}
document.images["photo"].src="photo" + n + ".jpg";
}
function previousphoto(){
if(n > 1){
n -= 1;}
else{
n = 14;}
document.images["photo"].src="photo" + n + ".jpg";
}
</script>


Under every browser I tested it with, this works just fine, but a friend of mine has an macintosh with ie 5, and when he browses through the photo's, very ofton just an empty picture frame appears. On the moment he drags the picture, the picture appears. Is there something i could do about it? Any help would really be appreciated.

Gollum
05-16-2003, 04:12 AM
It's quite possible the Mac issue is a red herring. I've noticed quite often images aren't displayed by the browser on PC platforms too. I think it's something to do with problems during download although I've seen it with cached images too.

anyway, this is what I came up with which might help fix your problem...

<img name="TheImage" src="someImage.gif" onerror="window.setTimeout('document.images[\'TheImage\'].src=\'someImage.gif\';',50);">

all this does is trap the onerror event on the image and schedules a bit of code to try again shortly.

redpi
05-16-2003, 09:19 AM
I tried this solutions but it didn't work. I discovered that he also has this problem with the very first picture, which is not selected through this script. A bug in ie? Anyway, thanks for your reaction!

khalidali63
05-16-2003, 09:32 AM
Originally posted by redpi
I A bug in ie? Anyway, thanks for your reaction!
I'd give serious thoughts in checking the web for IE bugs,IE 5 is notorious for its huge bug list on MAC OS,
Just outta curiousity,how come you are not using NS6+ on Mac OS?...plust the newset IE browser for Mac Os is more standard compliant then its match in windows,hence causing severe headachs to the IE js developers who are not used to follow strict coding standards.