Forum Moderators: open
That's the code:
<script>
function changeimage(towhat,url){
if (document.images){
document.images.targetimage.src=towhat.src
gotolink=url
}
}
function warp(){
window.location=gotolink
}
</script>
<script language="JavaScript1.1">
var myimages=new Array()
var gotolink="#"
function preloadimages(){
for (i=0;i<preloadimages.arguments.length;i++){
myimages[i]=new Image()
myimages[i].src=preloadimages.arguments[i]
}
}
preloadimages("pic1.gif","pic2.gif","pic3.gif","pic4.gif","pic5.gif")
</script>
function warp(){
window.location.href=gotolink
}
You could also try the following
function preloadimages(dir){
for (i=1; i < arguments.length; i++){
myimages[i] = new Image()
myimages[i].src = dir + '/' + arguments[i]
}}
The first param is now the directory and the remaining params are filenames within that directory.
Kaled.
for (var i=1; i < arguments.length; i++){
After that assuming that you have images located in a folder /images/test
you would preload images thus
preloadimages('/images/test','pic1.gif','pic2.gif','pic3.gif');
If that doesn't work, you need to open a javascript console to see if the script is generating errors. I prefer Opera for debugging scripts but Firefox is ok.
Kaled.