By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
464,330 Members | 1,132 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 464,330 IT Pros & Developers. It's quick & easy.

bad loading image -> SAFARI

P: n/a
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
Share this Question
Share on Google+
1 Reply

P: n/a
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.