Hello,
I'm designing a website and I wanted the front page so that everytime you loaded it/refreshed it a different picture was displayed. So I wrote a little Javascript and put it in my html. The script works fine, does exactly what I want it to do, but, when I load the page in IE6 it displays both the javascript images AND the <noscript> image I put in for people with java disabled. Doesn't seem to happen in Chrome only IE6. I sure I'm doing somthing obviously stupid but I cant see what.
Anyways here the java and html. Thanks.
HTML
Javascript
I'm designing a website and I wanted the front page so that everytime you loaded it/refreshed it a different picture was displayed. So I wrote a little Javascript and put it in my html. The script works fine, does exactly what I want it to do, but, when I load the page in IE6 it displays both the javascript images AND the <noscript> image I put in for people with java disabled. Doesn't seem to happen in Chrome only IE6. I sure I'm doing somthing obviously stupid but I cant see what.
Anyways here the java and html. Thanks.
HTML
Code:
<script type="text/javascript" src="js/test.js"></script>
<noscript>
<img src="images/five.jpg" height="350px" width="960" />
</noscript>
Javascript
Code:
function create() {
this.width = "960"
this.height = "350"
this.border = "0"
this.src = ''
}
pic = new Array()
for(var i=0; i<=5; i++) {
pic[i] = new create()
}
pic[0].src = "background/one.jpg"
pic[1].src = "background/one.jpg"
pic[2].src = "background/two.jpg"
pic[3].src = "background/three.jpg"
pic[4].src = "background/four.jpg"
pic[5].src = "background/five.jpg"
var n = Math.floor(Math.random()*5)
var image = pic[n]
var ad = '<img src="' + image.src + '" width="' + image.width + '"height=' + image.height
document.write(ad)
Last edited: