View Full Version : Image visibility controlled by date
Karl Z
02-12-2003, 07:22 AM
I´d like a script for controlling visibility of an image, depending on date. Is there a java-script or html-code for this?
I don´t know java, so I´d like to have a script ready-to-use , if possible.
Another possibility woul be if yuo know of an extension for Dreamweaver MX to fix this problem.
justame
02-12-2003, 12:32 PM
kar...
/me has this just a copied/pasted/saved® n' credited thisss from spook 05-21-2000 ...n' ittt just a changes® evvvery hour...mayyybe you can just a modify® it???
<html>
<head>
<title>Time of Day Image Change</title>
<script>
function changeImage() {
var today = new Date();
var hrs = today.getHours();
var img = new Image();
img.src = "images/hour"+hrs+".jpg";
document.images['myImage'].src = img.src;
}
</script>
</head>
<body onLoad="changeImage();">
<img src="baseImage.jpg" width="200" height="300" name="myImage">
</body>
</html>
Just name your images in this fashion:
hour0.jpg -->midnight
hour1.jpg -->1:00am
all the way up to:
hour23.jpg -->11:00pm
vBulletin® v3.8.2, Copyright ©2000-2012, Jelsoft Enterprises Ltd.