Hello,
I have searched the forums and can't find anything on this subject so i thought i would ask....
Is it at all possible to have a random loading header image when the page is refreshed?
For Example Code:
</head>
<SCRIPT LANGUAGE="JavaScript">
var theImages = new Array()
//Random-loading images
theImages[0] = 'http://www.mydomain.com/img.jpg' //
theImages[1] = 'http://www.mydomain.com/img1.jpg' //
theImages[2] = 'http://www.mydomain.com/img2.jpg' //
theImages[3] = 'http://www.mydomain.com/img3.jpg' //
var j = 0
var p = theImages.length;
var preBuffer = new Array()
for (i = 0; i < p; i++){
preBuffer[i] = new Image()
preBuffer[i].src = theImages[i]
}
var whichImage = Math.round(Math.random()*(p-1));
function showImage(){
if(whichImage==0){
document.write('<a href ="http://www.mydomain.com/index"><img src="'+theImages[whichImage]+'" border=0 width=720 height=450></a>');
}
else if(whichImage==1){
document.write('<a href ="http://www.mydomain.com/index"><img src="'+theImages[whichImage]+'" border=0 width=720 height=450></a>');
}
else if(whichImage==2){
document.write('<a href ="http://www.mydomain.com/index"><img src="'+theImages[whichImage]+'" border=0 width=720 height=450></a>');
}
else if(whichImage==3){
document.write('<a href ="http://www.mydomain.com/index"><img src="'+theImages[whichImage]+'" border=0 width=720 height=450></a>');
}
}
</script>
</head>
and then
<script>showImage();</script>
where the header would be placed.... just wondering any help is cool..
Thanks,
Phill
I have searched the forums and can't find anything on this subject so i thought i would ask....
Is it at all possible to have a random loading header image when the page is refreshed?
For Example Code:
</head>
<SCRIPT LANGUAGE="JavaScript">
var theImages = new Array()
//Random-loading images
theImages[0] = 'http://www.mydomain.com/img.jpg' //
theImages[1] = 'http://www.mydomain.com/img1.jpg' //
theImages[2] = 'http://www.mydomain.com/img2.jpg' //
theImages[3] = 'http://www.mydomain.com/img3.jpg' //
var j = 0
var p = theImages.length;
var preBuffer = new Array()
for (i = 0; i < p; i++){
preBuffer[i] = new Image()
preBuffer[i].src = theImages[i]
}
var whichImage = Math.round(Math.random()*(p-1));
function showImage(){
if(whichImage==0){
document.write('<a href ="http://www.mydomain.com/index"><img src="'+theImages[whichImage]+'" border=0 width=720 height=450></a>');
}
else if(whichImage==1){
document.write('<a href ="http://www.mydomain.com/index"><img src="'+theImages[whichImage]+'" border=0 width=720 height=450></a>');
}
else if(whichImage==2){
document.write('<a href ="http://www.mydomain.com/index"><img src="'+theImages[whichImage]+'" border=0 width=720 height=450></a>');
}
else if(whichImage==3){
document.write('<a href ="http://www.mydomain.com/index"><img src="'+theImages[whichImage]+'" border=0 width=720 height=450></a>');
}
}
</script>
</head>
and then
<script>showImage();</script>
where the header would be placed.... just wondering any help is cool..
Thanks,
Phill
Comment