You are here: Re: How do I put random quotes on my web site? « HTML « IT news, forums, messages
Re: How do I put random quotes on my web site?

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 :)

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация