Hello again, Im using the code below in a child page (popup), the images
are called from the parent page. When the changer is running, the child page goes white between images. I realise this is happening because the Images are not cached (yet) on the users browser.
I tried preloading images with the 2nd code below in the childpage head
and in the parent page head and both. no joy, dosent seem to actually 'preload' the pics. (i also gave definitions by adding width & height attributes but no difference. Is there anyway to solve this problem?

preveiw (click yellow highlighted link 'Pre-view active topics' near top)
note: first image (green python) is the childpage body BG (css)
In previous Instance of the changer code, links were called from photobucket.com, at that point, the images were cacheing after loading (so after the full cycle 15 pics there was no white between), I though calling the pics from the same domain would be better but now it dosent cache at all.
notice pics are attachments in the parent page, is that why no cache?

http://herproom.5.forumer.com/index.php?

<script LANGUAGE="JavaScript"> 
<!-- 
var BackgroundChangeIndex = 0; 
var wistol = new Array 
("http://herproom.5.forumer.com/index.php?act=Attach&type=post&id=9886","http://herproom.5.forumer.com/index.php?act=Attach&type=post&id=9887","http://herproom.5.forumer.com/index.php?act=Attach&type=post&id=9888","http://herproom.5.forumer.com/index.php?act=Attach&type=post&id=9889","http://herproom.5.forumer.com/index.php?act=Attach&type=post&id=9890","http://herproom.5.forumer.com/index.php?act=Attach&type=post&id=9891","http://herproom.5.forumer.com/index.php?act=Attach&type=post&id=9892","http://herproom.5.forumer.com/index.php?act=Attach&type=post&id=9893","http://herproom.5.forumer.com/index.php?act=Attach&type=post&id=9894","http://herproom.5.forumer.com/index.php?act=Attach&type=post&id=9895","http://herproom.5.forumer.com/index.php?act=Attach&type=post&id=9896","http://herproom.5.forumer.com/index.php?act=Attach&type=post&id=9897","http://herproom.5.forumer.com/index.php?act=Attach&type=post&id=9898","http://herproom.5.forumer.com/index.php?act=Attach&type=post&id=9899","http://herproom.5.forumer.com/index.php?act=Attach&type=post&id=9900"); 
function SetBackgroundImage() 
{ 
var BackgroundImage; 
BackgroundChangeIndex++; 
if (BackgroundChangeIndex >= wistol.length) 
{ 
BackgroundChangeIndex = 0; 
} 
BackgroundImage = wistol[BackgroundChangeIndex] 
document.body.style.cssText="background: url(" + BackgroundImage + ");" + "background-attachment: fixed; center; center;" 
setTimeout("SetBackgroundImage()", 10000) 
} 
//--> 
</script>

Code:

<SCRIPT language="JavaScript"> 
<!-- 
if (document.images) 
{ 
pic1= new Image(); 
pic1.src="http://herproom.5.forumer.com/index.php?act=Attach&type=post&id=9886"; 
pic2= new Image(); 
pic2.src="http://herproom.5.forumer.com/index.php?act=Attach&type=post&id=9887"; 
pic3= new Image(); 
pic3.src="http://herproom.5.forumer.com/index.php?act=Attach&type=post&id=9888"; 
pic3= new Image(); 
pic3.src="http://herproom.5.forumer.com/index.php?act=Attach&type=post&id=9889"; 
pic3= new Image(); 
pic3.src="http://herproom.5.forumer.com/index.php?act=Attach&type=post&id=9890"; 
pic3= new Image(); 
pic3.src="http://herproom.5.forumer.com/index.php?act=Attach&type=post&id=9891"; 
pic3= new Image(); 
pic3.src="http://herproom.5.forumer.com/index.php?act=Attach&type=post&id=9892"; 
pic3= new Image(); 
pic3.src="http://herproom.5.forumer.com/index.php?act=Attach&type=post&id=9893"; 
pic3= new Image(); 
pic3.src="http://herproom.5.forumer.com/index.php?act=Attach&type=post&id=9894"; 
pic3= new Image(); 
pic3.src="http://herproom.5.forumer.com/index.php?act=Attach&type=post&id=9895"; 
pic3= new Image(); 
pic3.src="http://herproom.5.forumer.com/index.php?act=Attach&type=post&id=9896"; 
pic3= new Image(); 
pic3.src="http://herproom.5.forumer.com/index.php?act=Attach&type=post&id=9897"; 
pic3= new Image(); 
pic3.src="http://herproom.5.forumer.com/index.php?act=Attach&type=post&id=9898"; 
pic3= new Image(); 
pic3.src="http://herproom.5.forumer.com/index.php?act=Attach&type=post&id=9899"; 
pic3= new Image(); 
pic3.src="http://herproom.5.forumer.com/index.php?act=Attach&type=post&id=9900"; 
} 
//--> 
</SCRIPT>

Have reverted back to offsite links for changer script and images are now cached after the full cycle (15 pics) Is there a way to stop the flicker?

Recommended Answers

All 2 Replies

> pic1.src="http://herproom.5.forumer.com/index.php?act=Attach&type=post&id=9886";
AFICT, the src attribute requires an absolute image path. In other words, it requires an URL and not an URI.

From what I can see, you are trying to send a request to the server with some given parameters which would after required processing would return an image as a response. If yes, then no, this won't work. Something like pic1.src="http://herproom.5.forumer.com/images/image1.jpg would be a good thing to try out. :-)

I tried the Preload Images Script with Full absolute urls aswell, it made no difference! Did you check out the link?

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.