Below is a simple preloader code I have... What I want to do is once
the images have completed preloading, the "Loading Images..." text
must disappear. I am not able to do it.
<html>
<head>
<title>Preloader</title>
</head>
<body>
<p>Lorem ipsum dolor sit amet, consectetuer adipiscing elit, sed diam
nonummy nibh euismod tincidunt ut laoreet dolore magna aliquam erat
volutpat.</p>
<div align="center">
<script type="text/javascript">
var imagenames=new Array('http://tbn0.google.com/images?
q=tbn:_Mg6ZYPbkBTWYM:http://www.sat.dundee.ac.uk/jpg/20020131-1205-
large.jpg' , 'http://tbn0.google.com/images?
q=tbn:UhAhRmP9ngqNoM:http://www.ari.uni-heidelberg.de/gaia/gallery/GR/
gr0283-01.artistic-Gaia-Galaxy-large.jpg');
var imagesdone=false;
var loaded=0, preloader, images=new Array();
var txt ='<p id="preloader" style="position:relative; background-
color:#aa00dd; color:#fff; font-size:12px; line-height:25px; vertical-
align:middle; width:300px; text-align:center; font-
family:Arial;">Loading Images...</p>';
document.write(txt);
function loadimages(){
preloader=document.getElementById('preloader');
for(n=0; n < imagenames.length; n++){
images[n]=new Image();
images[n].src=imagenames[n];
setTimeout("checkload('+n+')" ,n*100);
}
}
function dispbars(){
loaded++;
if(loaded >= imagenames.length) setTimeout('hidepreloader()',
800);
}
function checkload(index){
(images[index].complete)? dispbars() :
setTimeout('checkload('+index+')', 100);
}
function hidepreloader(){
preloader.style.visibility="hidden";
imagesdone=true;
}
loadimages();
</script>
</div>
<p>Lorem ipsum dolor sit amet, consectetuer adipiscing elit, sed diam
nonummy nibh euismod tincidunt ut laoreet dolore magna aliquam erat
volutpat.</p>
</body>
</html>
Randy Webb - 29 Sep 2007 04:58 GMT
white lightning said the following on 9/28/2007 11:47 PM:
> Below is a simple preloader code I have... What I want to do is once
> the images have completed preloading, the "Loading Images..." text
> must disappear. I am not able to do it.
You obviously are not able to read, understand, and appreciate the
advice already given to you about this question. What is to make anyone
believe your attitude will change now if someone spends the time to
explain everything that is wrong with your code, how to fix it, and then
have you post the same question again tomorrow?
Hint:
window.onload = changeTheText;
function changeTheText(){
//code here to change the text
//read the group FAQ, specifically DynWrite
//for potential code to go here.
}
<img src="image1.jpg" style="width:1px;height:1px;display:none">
<img src="image2.jpg" style="width:1px;height:1px;display:none">
<img src="image3.jpg" style="width:1px;height:1px;display:none">
Try it out......

Signature
Randy
Chance Favors The Prepared Mind
comp.lang.javascript FAQ - http://jibbering.com/faq/index.html
Javascript Best Practices - http://www.JavascriptToolbox.com/bestpractices/
white lightning - 29 Sep 2007 13:11 GMT
> white lightning said the following on 9/28/2007 11:47 PM:
>
[quoted text clipped - 7 lines]
> explain everything that is wrong with your code, how to fix it, and then
> have you post the same question again tomorrow?
If you find my question irritating, you do not have to reply... I can
ask whatever I want to ask.
Randy Webb - 29 Sep 2007 21:17 GMT
white lightning said the following on 9/29/2007 8:11 AM:
>> white lightning said the following on 9/28/2007 11:47 PM:
>>
[quoted text clipped - 8 lines]
>
> If you find my question irritating, you do not have to reply...
If you think that irritated me, you are further from the truth than you
are from finding an image preloading app.
> I can ask whatever I want to ask.
I never said you couldn't. I said you couldn't comprehend the answer
given to you. And you have proven that because I gave you the snippets
and a head start on how to try to do what you wanted to do.
If you ask the same question 3 times though I get to call you a stupid
moronic idiot (along with definitions of the words I use so people will
know what I wrote).

Signature
Randy
Chance Favors The Prepared Mind
comp.lang.javascript FAQ - http://jibbering.com/faq/index.html
Javascript Best Practices - http://www.JavascriptToolbox.com/bestpractices/