|
Posted by Chris Ianson on 03/18/06 00:55
"Toby Inkster" <usenet200603@tobyinkster.co.uk> wrote in message
news:l3rge3-ak2.ln1@ophelia.g5n.co.uk...
<snip>
> setTimeout("randquote();", 15000);
> }
> randquote();
> </script>
>
> Ideally, you probably don't want an <INPUT> element, but want to use <Q>
> or such. Done easily enough though.
>
> --
> Toby A Inkster BSc (Hons) ARCS
> Contact Me ~ http://tobyinkster.co.uk/contact
That's great Toby. Here's the actual code I found that worked for the page
refresh, but didn't include your timeout.
Can you help me integrate a timeout function into my existing code below, so
the quote changes say every 45 seconds, and is also randomised on page
refresh please?
<script language="JavaScript">
var howMany = 2
var quote = new Array(howMany+1)
quote[0]="quote1"
quote[1]="quote2"
quote[2]="quote3"
function rndnumber(){
var randscript = -1
while (randscript < 0 || randscript > howMany || isNaN(randscript)){
randscript = parseInt(Math.random()*(howMany+1))
}
return randscript
}
quo = rndnumber()
quox = quote[quo]
document.write(quox)
// End --></script>
Thanks in advance :)
[Back to original message]
|