Log in

View Full Version : Image According to the day



ian8nox
06-10-2008, 02:56 AM
I'm trying to find a script of some sort that shows an image according to the date(ie on the 1st, 2nd, 3rd, etc of each month) and also one that can show an image according to the month. I want to put the date up on my website but I want to do it by image so I can control how it looks. If anyone knows something that could do this, that would be great! Thank you in advance!

-Ian

jscheuer1
06-10-2008, 07:10 AM
In about the simplest terms, you could have something like so:


<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<title></title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">

</head>
<body>
<script type="text/javascript">
;(function(){
var d = new Date();
document.write('<img src="mo_' + d.getMonth() + '.gif"><img src="day_' + d.getDate() + '.gif">');
})();
</script>
</body>
</html>

This would allow you to have month images:

mo_0.gif

through:

mo_11.gif

for Jan (0) through Dec. (11). And day images:

day_1.gif

through

day_31.gif

for each possible date of the month (1 to 31).

ian8nox
06-10-2008, 04:25 PM
Cool, thanks, simple is much better for me than highly complicated. And actually? I actually understand this script and how it works!(i usually don't understand them, I just use them) Thanks!

-Ian