Search Engine Optimization > Web Development > img .src problem with Firefox 0.9
img .src problem with Firefox 0.9
Posted by Anthony Hughes on June 29th, 2004

I've got a curious problem with a bit of JavaScript and the new 0.9 release of
Firefox. I installed the same version from the same installer at work and at
home - the problem only appears at home.

Basically I'm using some js to set the source and alt text of an image
dynamically, but in the problem set up, the source dosn'r change, only the alt
does.

Here's a complete test doc which demonstrates the problem:

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html>
<head>
<title></title>
<script type="text/javascript">

function setSrc(fname)
{
var x = document.getElementById("image")
x.src = fname
x.alt = fname
}
</script>
</head>
<body>

<a href = "1.jpg" onclick="setSrc('1.jpg');return false;"> Image 1</a>
<a href = "2.jpg" onclick="setSrc('2.jpg');return false;"> Image 2</a>
<a href = "3.jpg" onclick="setSrc('3.jpg');return false;"> Image 3</a>

<hr>

<img id="image" src="default.jpg" alt="default" />

</body>
</html>

When you click on the links, it should show the corresponding image. It works
fine in IE on both systems, it works fine on Firefox at work, but at home, the
image source never changes. Hovering over the image shows the correct alt text
for the selected link. Reading the .src back and displaying it in an alert
shows the original value (default.jpg")

Anyone have any clues on this??
Cheers
Ant

Posted by Amos E Wolfe on June 29th, 2004


"Anthony Hughes" <ahughes@NOSPAMrm.com> wrote in message
news:cbrolo$qu2$1@newsfeed.th.ifl.net...
Sorry to be obvious but have you tried refershing the page? - Firefox seems
very stubborn at keeping cached pages on-screen when IE does not.

Also - have you inserted a script to pre-load images, if not why not? Anyone
on 56k (maybe you at home) will notice the difference.

-=# Amos E Wolfe #=-



Posted by Anthony Hughes on June 30th, 2004

In article <cbsl0e$c6o$1@sparta.btinternet.com>, "Amos E Wolfe" <amos.wolfe@btopenworld.com> wrote:

Hi Amos,

Yeah, I tried that, but of course that just resets the image back to the
default (which is correct behaviour on platforms that work)... but I wondered
if it was some sort of caching problem...

No - the idea is this is ultimately for browsing a collection of pictures via
thumbnails so I only want to download the ones the user selects to view.

This means that they don't have to wait for unwanted images to preload before
viewing the one(s) they want, and it also greatly reduces the bandwith demands
on the site.

At this testing stage it's all just local content so I don't think the problem
I'm seeing is speed related...

Cheers
Ant

Funbolt.com - Entertainment portal, wallpapers, sexy celebs