469,641 Members | 1,249 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,641 developers. It's quick & easy.

bad loading image -> SAFARI

I did a javascript for the loading of images (I didn't want to have
the images loaded in "on loading" because they are too many).

The website is for a model and if you look at the codeof pages ( for
ex. http://www.agathamoon.com/gallery_48_eng.htm ) using explorer or
firefox it works, with safari it doesn't! :(

The idea is to have the word "loading" appearing while going from an
image to another.

Here it's what there's in the head:
<script>
function imgLoad(myImg)
{
showLoading();
newImage = new Image();
newImage.src = myImg;
document.images['image_big_on'].src=myImg;

if (newImage.complete )
showImage();
else
newImage.onload=showImage;
}

function showLoading()
{
document.images['image_big_on'].style.display='none';
document.all.warning.style.display='inline ';
}

function showImage()
{
document.all.warning.style.display='none';
document.images['image_big_on'].style.display='inline';
}
//-->
</script>

Here how the script appears durind the loading in the body:

<td align="center"><SPAN class="index" id=warning style="DISPLAY:
none">Loading image...</span><img src="img/gallery/a_o/cover.jpg"
name="image_big_on" border="0" id="image_big_on"></td>

and here I recall the javascript in the body:

<A href="javascript:imgLoad('img/gallery/a_o/01.jpg');"><img
src="img/gallery/a_o/01_thumb.jpg" width="40" height="40"
border="0"></a>

Do you know what's wrong with the process?

Being the site of a model it's visited by lots of photographers, a big
part of them uses a mac and safari.

I thank you very much for your help.

AM
www.agathamoon.com

Feb 4 '07 #1
1 3190
ag*********@gmail.com said the following on 2/3/2007 7:29 PM:
I did a javascript for the loading of images (I didn't want to have
the images loaded in "on loading" because they are too many).

The website is for a model and if you look at the codeof pages ( for
ex. http://www.agathamoon.com/gallery_48_eng.htm ) using explorer or
firefox it works, with safari it doesn't! :(
Stop using IE proprietary code and it will probably work in Safari. The
only reason it "works" in Firefox is because Firefox put in support for
document.all so that pages written by IE centric people could still be
viewed.

<snip>
function showLoading()
{
document.images['image_big_on'].style.display='none';
document.all.warning.style.display='inline ';
document.getElementById('warning').style.display
}

function showImage()
{
document.all.warning.style.display='none';
document.images['image_big_on'].style.display='inline';
document.getElementById('warning').style.display

<snip>
<A href="javascript:imgLoad('img/gallery/a_o/01.jpg');"><img
src="img/gallery/a_o/01_thumb.jpg" width="40" height="40"
border="0"></a>
<URL: http://jibbering.com/faq/index.html#FAQ4_24>

--
Randy
Chance Favors The Prepared Mind
comp.lang.javascript FAQ - http://jibbering.com/faq/index.html
Javascript Best Practices - http://www.JavascriptToolbox.com/bestpractices/
Feb 4 '07 #2

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

5 posts views Thread by OneSolution | last post: by
2 posts views Thread by Mekon | last post: by
4 posts views Thread by Adrian MacNair | last post: by
6 posts views Thread by Ivan Bútora | last post: by
5 posts views Thread by toffee | last post: by
5 posts views Thread by =?Utf-8?B?V2FubmFiZQ==?= | last post: by
4 posts views Thread by Sophy | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.