Daily comic wallpaper help!

D

da8om8

Guest
Currently, my desktop is an html page that shows new comics on it every day (from www.ucomics.com)

The coding is shown at the end of this message (I copied it from another forum: I don't know much about javascript or html :(). The URL for the comics are different everyday (to avoid leeching i guess :D) and the URL itself contains the date in a strange format (year/month/date).

The problem: On the 1st day of every month, it gets the date wrong & hence the comics wont load - eg on the 1st of October it will think thats its the 31st of September :mad:

The desktop works fine for every other day, and u can see from the attached screenshot.

Thanks in advance!!

Coding for desktop:

<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<script language="JavaScript1.2">

function reset_image(name, pad) {

today = new Date();
if (pad > 0) {
today = new Date(today.getTime() - pad);
}

year = today.getYear();
if (year > 2009) {
year -= 2000;
year = new String(year);
}
else if (year > 2000) {
year -= 2000;
year = '0' + new String(year);
}
else if (year > 9) {
year = '0' + new String(year);
}
else {
year = new String(year);
}

if (today.getMonth() > 8) {
month = new String(today.getMonth() + 1);
}
else {
month = '0' + new String(today.getMonth() + 1);
}

if (today.getDate() > 8) {
day = new String(today.getDate() + 1);
}
else {
day = '0' + new String(today.getDate() + 1);
}

setTimeout("reset_image('" + name + "', 0)", 3600000);
if (name == 'penny') {
url = 'http://images.ucomics.com/comics/tmani/20' + year + '/tmani' + year + month + day + '.gif';
}
else if (name == 'garfield') {
url = 'http://images.ucomics.com/comics/ga/20' + year + '/ga' + year + month + day + '.gif';
}
eval('document.' + name + '_invisible.src = url');
}

</script>
</head>
<body bgcolor="#34629e"
onload="reset_image('penny', 86400000);reset_image('garfield', 86400000);"
background="rebirth_1024.jpg">
<table width="100%" height="100%" border="0">
<tbody>
<tr height="0">
<td align="right" valign="top"> <img name="penny_invisible" src=""
onload="document.penny_visible.src=this.src" width="0" height="0"
style="visibility: hidden;"> <img name="penny_visible"
alt=""> </td>
</tr>
<tr height="0">
<td align="right" valign="bottom"> <img name="garfield_invisible"
src="" onload="document.garfield_visible.src=this.src" width="0"
height="0" style="visibility: hidden;"> <img name="garfield_visible"
alt=""> </td>
</tr>
</tbody>
</table>
</body>
</html>
 
I've seen this before. The problem then was that the dates from 01 to 09 weren't prefixed with zero... mwell. My suggestion is for you to work something out in ASP or PHP. But then again, I'm more experienced with those two than I am with JavaScript so I don't really know all you can do. ;>
 

Members online

No members online now.

Latest profile posts

Also Hi EP and people. I found this place again while looking through a oooollllllldddd backup. I have filled over 10TB and was looking at my collection of antiques. Any bids on the 500Mhz Win 95 fix?
Any of the SP crew still out there?
Xie wrote on Electronic Punk's profile.
Impressed you have kept this alive this long EP! So many sites have come and gone. :(

Just did some crude math and I apparently joined almost 18yrs ago, how is that possible???
hello peeps... is been some time since i last came here.
Electronic Punk wrote on Sazar's profile.
Rest in peace my friend, been trying to find you and finally did in the worst way imaginable.

Forum statistics

Threads
62,015
Messages
673,494
Members
5,623
Latest member
AndersonLo
Back