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 Toby Inkster on 03/13/06 20:43

Jose wrote:

> Some browsers will reload the page. With HTML that's the only way to do
> it (that I know of).

Then you don't know of very much:

<p>
<b>No reloads:</b>
<input id="foo" style="width:100%">
</p>
<script type="text/javascript">
quote = new Array(4);
quote[0] = "I came, I saw, I conquered";
quote[1] = "Men believe that willingly which they wish to be true.";
quote[2] = "All bad precedents begin as justifiable measures.";
quote[3] = "Et tu, Brute.";
function randquote ()
{
var f = document.getElementById("foo");
var q = Math.round(Math.random()*4);
f.value = quote[q];
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

 

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

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