...

View Full Version : Random Quote help



scrub
07-12-2003, 06:14 AM
Hi,
I've been looking everywhere for a code that will give me random quote(plain text) like every 3-5 seconds, but I could only find Quote of the Day or a quote that will change only if you reload the page.
For example, it'll show one, and 3 seconds later it'll fade out and a new quote will fade in, and so on...
Thanks

cheesebagpipe
07-14-2003, 10:39 PM
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<style type="text/css">

body {
background: #507010;
}

div#Q1, div#Q2 {
position: absolute;
width: 90%;
font: 200 18px "times new roman", serif;
color: white;
margin: 24px;
filter: alpha(opacity=0);
-moz-opacity: 0%;
}

</style>
<script type="text/javascript" language="javascript">

// customize below ================================================ //
// escape all quote apostrophes with backslashes! ================= //

rQ.quotes = new Array(

'It is impossible to travel faster than the speed of light, and certainly not desirable, as one\\'s hat keeps blowing off.' ,
'What if everything is an illusion and nothing exists? In that case, I definitely overpaid for my carpet.' ,
'Organized crime in America takes in over forty billion dollars a year and spends very little on office supplies.' ,
'Being bisexual doubles your chance of a date on Saturday night.' ,
'If only God would give me some clear sign! Like making a large deposit in my name at a Swiss bank.' ,
'Sex without love is an empty gesture. But as empty gestures go, it is one of the best.' ,
'Why does man kill? He kills for food. And not only food: frequently there must be a beverage.' ,
'Death should not be seen as the end, but as a very effective way to cut down expenses.' ,
'It\\'s impossible to experience one\\'s death objectively and still carry a tune.' ,
'Whosoever shall not fall by the sword or by famine, shall fall by pestilence so why bother shaving?' //no comma!

);

rQ.randomize = true; //shuffle quote order initially?

rQ.startpause = 2; //start delay in seconds
rQ.showpause = 10; //display time in seconds
rQ.fade = 40; //fade duration (greater = slower)
rQ.fadefirst = false; //fade-in first quote? (true/false)

// customize above =============================================== //
// &#61;&#61;&#61;&#61;&#61;&#61;&#61;&#61;&#61;&#61;&#61;&#61;&#61;&#61;&#61;&#61;&#61;&#61;&#61;&#61;&#61;&#61;&#61;&#61;&#61;&#61;&#61;&#61;&#61;&#61;&#61;&#61;&#61;&#61;&#61;&#61;&#61;&#61;&#61;&#61;&#61;&#61;&#61;&#61;&#61;&#61;&#61;&#61;&#61;&#61;&#61;&#61;&#61;&#61;&#61;&#61;&#61;&#61;&#61;&#61;&#61;&#61;&#61; //

if (rQ.randomize) {
rQ.quotes.swap = function(index1,index2) { //thanks, Vladdy! [http&#58;//klproductions.com:8080/]
var temp = this[index1];
this[index1] = this[index2];
this[index2] = temp;
return;
}

rQ.quotes.shuffle = function() { //likewise...
for (var i=0; i<this.length; i++) {
ind1 = Math.floor(Math.random() * this.length);
ind2 = Math.floor(Math.random() * this.length);
this.swap(ind1,ind2);
}
return;
}

rQ.quotes.shuffle();
}

rQ.whichid = 'Q1';
rQ.whichQ = 0;
rQ.isie = (document.all && document.getElementById);
rQ.ismoz = (!document.all && document.getElementById);

function rQ() {
rQ.hi = document.getElementById(rQ.whichid);
rQ.whichid = (rQ.whichid == 'Q1') ? 'Q2' : 'Q1';
rQ.bye = document.getElementById(rQ.whichid);
var newQ = document.createTextNode(rQ.quotes[rQ.whichQ++]);
rQ.hi.replaceChild(newQ, rQ.hi.firstChild);
rQ.whichQ = (rQ.whichQ == rQ.quotes.length) ? 0 : rQ.whichQ;
rQ.f1 = (rQ.isie) ? rQ.hi.filters.alpha : rQ.hi.style;
rQ.f2 = (rQ.isie) ? rQ.bye.filters.alpha : rQ.bye.style;
if (rQ.fadefirst) {
if (rQ.isie)
rQ.t1 = setInterval('rQ.f1.opacity=++rQ.f1.opacity;if(rQ.f1.opacity==100)clearInterval(rQ.t1)',rQ.fade);
else if (rQ.ismoz)
rQ.t1 = setInterval('rQ.f1.MozOpacity=rQ.f1.MozOpacity+.01;if(rQ.f1.MozOpacity==1)clearInterval(rQ.t1)',rQ.f ade);
rQ.fadefirst = false;
return;
}
if (rQ.isie) {
rQ.t1 = setInterval('rQ.f1.opacity=100-rQ.f2.opacity;if(rQ.f1.opacity==100)clearInterval(rQ.t1)',rQ.fade);
rQ.t2 = setInterval('--rQ.f2.opacity;if(rQ.f2.opacity==0)clearInterval(rQ.t2)',rQ.fade);
} else if (rQ.ismoz) {
rQ.t1 = setInterval('rQ.f1.MozOpacity=1-rQ.f2.MozOpacity;if(rQ.f1.MozOpacity==1)clearInterval(rQ.t1)',rQ.fade);
rQ.t2 = setInterval('rQ.f2.MozOpacity=rQ.f2.MozOpacity-.01;if(rQ.f2.MozOpacity==0)clearInterval(rQ.t2)',rQ.fade);
}
}

//start display
onload = function() {
setTimeout('rQ();setInterval("rQ()", rQ.showpause * 1000);', rQ.startpause * 1000);
}

</script>
</head>
<body>
<div id="Q1">&amp;nbsp;</div>
<div id="Q2">&amp;nbsp;</div>
</body>
</html>



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum