Lillebitte hjemmeside, hvor "bor" den bedst ?
Jeg vil lave en lillebitte hjemmeside,den skal kun kunne køre nedenstående fil:
Den viser et nyt foto hver dag
i 20 dage, og så starter den forfra
og viser billede 1 igen.
Hvor skal jeg leje mig ind,
hvor "bor" koden bedst og billigst ?
slide.html
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title></title>
<script type="text/javascript">
var slideimages = new Array() // create new array to preload images
slideimages[0] = new Image() // create new instance of image object
slideimages[0].src = "firstcar.gif" // set image src property to image path, preloading image in the process
slideimages[1] = new Image()
slideimages[1].src = "secondcar.gif"
slideimages[2] = new Image()
slideimages[2].src = "thirdcar.gif"
slideimages[3] = new Image()
slideimages[3].src = "thirdcar.gif"
slideimages[4] = new Image()
slideimages[4].src = "thirdcar.gif"
slideimages[5] = new Image()
slideimages[5].src = "thirdcar.gif"
slideimages[6] = new Image()
slideimages[6].src = "thirdcar.gif"
slideimages[7] = new Image()
slideimages[7].src = "thirdcar.gif"
slideimages[8] = new Image()
slideimages[8].src = "thirdcar.gif"
slideimages[9] = new Image()
slideimages[9].src = "thirdcar.gif"
slideimages[10] = new Image()
slideimages[10].src = "thirdcar.gif"
slideimages[11] = new Image()
slideimages[11].src = "thirdcar.gif"
slideimages[12] = new Image()
slideimages[12].src = "thirdcar.gif"
slideimages[13] = new Image()
slideimages[13].src = "thirdcar.gif"
slideimages[14] = new Image()
slideimages[14].src = "thirdcar.gif"
slideimages[15] = new Image()
slideimages[15].src = "thirdcar.gif"
slideimages[16] = new Image()
slideimages[16].src = "thirdcar.gif"
slideimages[17] = new Image()
slideimages[17].src = "thirdcar.gif"
slideimages[18] = new Image()
slideimages[18].src = "thirdcar.gif"
slideimages[19] = new Image()
slideimages[19].src = "thirdcar.gif"
</script>
</head>
<body>
<img src="firstcar.gif" id="slide" width="100" height="56" />
<script type="text/javascript">
//variable that will increment through the images
var step=0
var d = new Date();
var dag=d.getDate();
function slideit(){
//if browser does not support the image object, exit.
if (!document.images)
return
var nudag=d.getDate();
if (nudag==dag) {
document.getElementById('slide').src = slideimages[step].src
dag = nudag
if (step<19)
step++
else
step=0
}
//call function "slideit()" every minute
setTimeout("slideit()",60000)
}
slideit()
</script>
</body>
</html>