Random Text Display with Java Script.
Way back when, I wanted to make a random shakesperean insult generator. I can't write anything beyond stupid shell scripts, so I turned to the internets. They failed me. I found a lot of bits and pieces, many of which I couldn't get to work. Maybe it was me, maybe it was them. It doesn't matter.
The internets and I have finally reconciled our differences, and I found some chunks of javascript that put me on the right path. A little basic manual reading and I was able to get it to work. So, incase you've been looking, and like me, don't want to use cgi and randtext.pl etc, here is a simple javascript you can include to dispalay random messages:
<script language="JavaScript">
random_message = new Array();
random_message[0] = "It is suck? We are fight!";
random_message[1] = "What is plus equal to? Zero is plus. Zero thousand!";
random_message[2] = "Zero Thousand makes things null";
random_message[3] = "We can't brain today: we have the dumb.";
var numb = random_message.length;
var doit = random_message[Math.round(Math.random()*numb)];
document.write(doit);
</script>
Oh, and here is that shakesperean insult generator I always wanted: