110mb.com Forum
News: Currently none. But refer to this news before you post an error, maybe it's already being fixed Wink
 
*
Welcome, Guest. Please login or register.
Did you miss your activation email?
December 06, 2008, 01:44:35 AM


Login with username, password and session length


Pages: [1]   Go Down
  Send this topic  |  Print  
Author Topic: TIP: Random quote generator script  (Read 1008 times)
zaman
Advanced Authority Member
*****
Offline Offline

Posts: 1102


« on: February 01, 2007, 09:56:07 AM »

This is a very simple javascript to generate random quotes at any place of a webpage you want it to appear and any quote which you want to appear. Just insert this script in your webpage wherever you want the random quote to appear.
Quote
         <script language="JavaScript">

var Quotation=new Array()


Quotation[0] = "Time is of the essence! Comb your hair.";
Quotation[1] = "Sanity is a golden apple with no shoelaces.";
Quotation[2] = "The image is more than an idea. It is a vortex or cluster of fused ideas and is endowed with energy. ~ Ezra Pound";
Quotation[3] = "Honesty blurts where deception sneezes.";
Quotation[4] = "Pastry satisfies where art is unavailable.";
Quotation[5] = "Image creates desire. You will what you imagine. ~ J. G. Gallimore";
Quotation[6] = "The image cannot be dispossessed of a primordial freshness, which idea can never claim. An idea is derivative and tamed. The image is in the natural or wild state, and it has to be discovered there, not put there, obeying its own law and none of ours. ~John Crowe Ransom";
Quotation[7] = "Wishes are like goldfish with propellors.";
Quotation[8] = "Love the river's \"beauty\", but live on a hill.";
Quotation[9] = "Invention is the mother of too many useless toys.";
Quotation[10] = "I want to know God's thoughts... the rest are details.~ Albert Einstein ";

// ======================================
// Do not change anything below this line
// ======================================
var Q = Quotation.length;
var whichQuotation=Math.round(Math.random()*(Q-1));
function showQuotation(){document.write(Quotation[whichQuotation]);}
showQuotation();
</script></p>

You can increase the numbers and the quotes as you like but make sure they are in single lines. You can see the demo in my home page. There is a quote of the moment which is actually made by using this script.

http://zaman.110mb.com
« Last Edit: February 04, 2007, 01:49:08 PM by Diemux » Logged
zaman
Advanced Authority Member
*****
Offline Offline

Posts: 1102


« Reply #1 on: February 02, 2007, 05:50:37 AM »

Increase the number of quotations by increasing in the same format like
Quotation[10]
Quotation[11]

And if you want any word or phrase to appear in double inverted commas in a line just make sure it looks like  \"beauty\" where the word beauty would be in double inverted commas. And when you edit the quotation line try to maintain it within a single line although it might be as long as possible, as I had faced a few problems with line breakups.
And kindly leave any comments if it is useful.
 smiley
Logged
sevensealscomputing
Member
*
Offline Offline

Posts: 31


WWW
« Reply #2 on: February 04, 2007, 01:20:40 PM »

If you want to supercharge this baby, hook it up with a MySQL database and PHP script to dynamically generate the script.
Logged

mastermask4
Member
*
Offline Offline

Posts: 3


WWW
« Reply #3 on: March 03, 2008, 05:53:07 AM »

This is a cool script, but can you put hyperlinks in it, like <a href="url"></a>?
It works if you don't use the commas like this: <a href=url></a>
Is that ok?
grin Thanks
« Last Edit: March 03, 2008, 05:59:40 AM by mastermask4 » Logged
Pages: [1]   Go Up
  Send this topic  |  Print  
 
Jump to:  

  Powered by SMF 1.1.5 | SMF © 2006-2008, Simple Machines LLC

Theme by Dilber MC | Using SEO4SMF Mod

All content on this forum (especially posts) is copyright property of 110mb & the member
who wrote the post. So if you wish to steal anyone's post on this forum, you'll wish you
were dead because our lawyers will sue your ass!