Javascript slideshow defaults to alt text in Mozilla Firefox

A place to ask questions and get help. Be the first on your block to post ...

Javascript slideshow defaults to alt text in Mozilla Firefox

Postby caggens » Wed Sep 27, 2006 4:48 pm

Our site layout relies heavily on javascript slide shows similar to the random promos (only larger).

These slide shows view properly using IE on a PC and Safari on a Mac, but the images default to the alternate text when viewed with Mozilla on a Mac.

What if anything can I do to correct this problem?

Posts: 65
Joined: Tue Jun 21, 2005 10:52 am
Location: RH 120

Postby saltybeagle » Wed Sep 27, 2006 10:59 pm

Aside from any javascript errors, (which there are none I can see)... two things can prevent the image from loading. The src attribute should, by default, load an image. It doesn't have to be an actual image, but something valid should load prior to the javascript firing.
I would use a transparent image like this one: ... spixel.gif
which is distributed with the templates.

The other necessity is that the element the image is rotated into (<img id="large1") needs to be loaded within the DOM (document object model) tree. The dom tree is created as the browser parses the source of the web page you are viewing, and allows every element within the html/xml document to be accessed. The javascript needs to be able to find the element within the dom tree when it fires, so moving the javascript call lower in your source code will increase the amount of time between when the browser parses the source of the image element and creating a referenceable node within the dom tree. I hope that makes sense.

So, I would do two things. Change your image source to be like this:
Code: Select all
<div class="image_large"><img id="large1" src="" alt=" art department image" /> </div>

and move the javascript futther down in the source code of your page
Code: Select all
<script type="text/javascript"  src="sharedcode/680x210.js"></script>

Hopefully that will get the random image loading within all the browsers.
Brett Bieber
Posts: 376
Joined: Fri Jan 16, 2004 3:10 pm
Location: 321 Admin

Return to Help & Assistance

Who is online

Users browsing this forum: No registered users and 1 guest