I've just attempted to upload my website using 000webhost, and have a small section of the page written in Javascript. For some reason, this refuses to display on any browser. All of the locations of the pictures which it ought to be showing are correct, and it works fine when I view it locally (by opening my html document in a browser). Any ideas?
Here is the page: http://marknichols.net84.net/ (I know that there isn't very much up at the moment!). The picture in the top left (not just black and white) is not written in Javascript on that page, but I would like it to be; I want it to rotate through a selection of different pictures when the page is refreshed.
Here is the Javascript script that works fine locally, but which, for some reason, I can't get working when it's uploaded:
Rather than displaying one of the pictures, it merely displays a small box at the top left of the screen. Thanks in advance for the help
Here is the page: http://marknichols.net84.net/ (I know that there isn't very much up at the moment!). The picture in the top left (not just black and white) is not written in Javascript on that page, but I would like it to be; I want it to rotate through a selection of different pictures when the page is refreshed.
Here is the Javascript script that works fine locally, but which, for some reason, I can't get working when it's uploaded:
Code:
<script language="Javascript">
<!--
var imlocation = "images/";
var currentdate = 0;
var image_number = 0;
function ImageArray (n) {
this.length = n;
for (var i =1; i <= n; i++) {
this[i] = ' '
}
}
image = new ImageArray(6)
image[0] = 'brightsmall.jpg'
image[1] = 'colourfulsmall.jpg'
image[2] = 'focussedsmall.jpg'
image[3] = 'not black and whitesmall.jpg'
image[4] = 'yellow mellowsmall.jpg'
image[5] = 'font.jpg'
var rand = 60/image.length
function randomimage() {
currentdate = new Date()
image_number = currentdate.getSeconds()
image_number = Math.floor(image_number/rand)
return(image[image_number])
}
document.write("<img src='" + imlocation + randomimage()+ "'>");
//-->
</script>
Rather than displaying one of the pictures, it merely displays a small box at the top left of the screen. Thanks in advance for the help
Last edited: