hi,
just wondering if someone could assist me modify this script to display a random amount of quotes?
i.e. sometimes it might return and display 2 quotes, then 1 quote, then maybe 3 quotes?
rather than it is now, 1 quote per time.
thanks!!!Code:<script type="text/javascript"> <!-- //I. Array of banner that will randomly appear var randomquote = new Array ( ); randomquote[0] = '<em>"Nothing is more fairly distributed than common sense: no one thinks he needs more of it than he already has."</em><br/><br/><span class="alignright">-- Rene Descartes</span>'; randomquote[1] = '<em>"Our virtues and our failings are inseparable, like force and matter. When they separate, man is no more."</em><br/><br/><span class="alignright">-- Nikola Tesla</span>'; randomquote[2] = '<em>"Better to illuminate than merely to shine, to deliver to others contemplated truths than merely to contemplate."</em><br/><br/><span class="alignright">-- Thomas Aquinas</span>'; //II. function to generate number from 0 to n function randomzero (n) { return ( Math.floor ( Math.random ( )*0.9999999999999999* (n + 1)) ); } //III. assign any random number from 0 to 2 to x. x = randomzero(2); //IV. display the text document.write(randomquote[x]); //--> </script>


Reply With Quote
Bookmarks