edczxcvbnm
02-22-2006, 06:12 PM
Just make a new text document and paste this code into it. Save it so that it is an HTML document. Open it up and you have your random comics.
Attached are some of the example I have created using this generator.
<html>
<head>
<title>The Eagle_Fire Garfield Randomizer</title>
<style type='text/css'>
td {
overflow: hidden;
text-align: left;
vertical-align: top;
max-height: 200px;
max-width: 180px;
}
img {
positron: absolute;
}
</style>
</head>
<body>
<table border=1><tr>
<td width=200 height=180 id=td1> </td>
<td width=200 height=180 id=td2> </td>
<td width=200 height=180 id=td3> </td>
</tr>
<tr>
<td><input type=checkbox id=ck1>Lock</td>
<td><input type=checkbox id=ck2>Lock</td>
<td><input type=checkbox id=ck3>Lock</td>
</tr>
</table>
<script language="JavaScript1.2">
function fmt(n) {
n = Math.floor(n);
if (n < 10) return "0" + n;
return n;
}
function load() {
var t = new Array("td1", "td2", "td3");
var c = new Array("ck1", "ck2", "ck3");
for (i = 0; i < t.length; i++) {
if (document.getElementById(c[i]).checked) continue;
year = 2001 + Math.random() * 4;
month = Math.random() * 12 + 1;
day = Math.random() * 30 + 1;
panel = Math.random() * 3;
if ((new Date(fmt(month) + "/" + fmt(day) + "/" + fmt(year))).getDay() == 0)
day = (day + 1) % 31 + 1;
if (month == 2 && day > 28) day = 28;
imgurl = "http://images.ucomics.com/comics/ga/"
+ fmt(year) + "/ga" + fmt(year % 100) + fmt(month) + fmt(day) + ".gif";
tu = document.getElementById(t[i]);
tu.background = imgurl;
tu.style.background = "url(" + imgurl + ") " + -200 * Math.floor(panel) + "px 0px";
}
}
load();
</script>
<br>
<input type='button' value = "Go" onClick="load()">
</body>
</html>
Attached are some of the example I have created using this generator.
<html>
<head>
<title>The Eagle_Fire Garfield Randomizer</title>
<style type='text/css'>
td {
overflow: hidden;
text-align: left;
vertical-align: top;
max-height: 200px;
max-width: 180px;
}
img {
positron: absolute;
}
</style>
</head>
<body>
<table border=1><tr>
<td width=200 height=180 id=td1> </td>
<td width=200 height=180 id=td2> </td>
<td width=200 height=180 id=td3> </td>
</tr>
<tr>
<td><input type=checkbox id=ck1>Lock</td>
<td><input type=checkbox id=ck2>Lock</td>
<td><input type=checkbox id=ck3>Lock</td>
</tr>
</table>
<script language="JavaScript1.2">
function fmt(n) {
n = Math.floor(n);
if (n < 10) return "0" + n;
return n;
}
function load() {
var t = new Array("td1", "td2", "td3");
var c = new Array("ck1", "ck2", "ck3");
for (i = 0; i < t.length; i++) {
if (document.getElementById(c[i]).checked) continue;
year = 2001 + Math.random() * 4;
month = Math.random() * 12 + 1;
day = Math.random() * 30 + 1;
panel = Math.random() * 3;
if ((new Date(fmt(month) + "/" + fmt(day) + "/" + fmt(year))).getDay() == 0)
day = (day + 1) % 31 + 1;
if (month == 2 && day > 28) day = 28;
imgurl = "http://images.ucomics.com/comics/ga/"
+ fmt(year) + "/ga" + fmt(year % 100) + fmt(month) + fmt(day) + ".gif";
tu = document.getElementById(t[i]);
tu.background = imgurl;
tu.style.background = "url(" + imgurl + ") " + -200 * Math.floor(panel) + "px 0px";
}
}
load();
</script>
<br>
<input type='button' value = "Go" onClick="load()">
</body>
</html>