Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > HTML > How do I put random quotes on my web site?

Reply
Thread Tools

How do I put random quotes on my web site?

 
 
Chris Ianson
Guest
Posts: n/a
 
      03-10-2006
Hi, I'm looking for a simple newbie way to put quotes into HTML code, and
have them randomise each time the page is refreshed. What's the easy
solution?

Thanks in advance.


 
Reply With Quote
 
 
 
 
Jim Moe
Guest
Posts: n/a
 
      03-10-2006
Chris Ianson wrote:
> Hi, I'm looking for a simple newbie way to put quotes into HTML code, and
> have them randomise each time the page is refreshed. What's the easy
> solution?
>

Client-side: use Javascript. Server-side: use PHP, JSP, perl, etc.
Open a file of quotes, use a random number generator to select a line of
text, print it.

--
jmm (hyphen) list (at) sohnen-moe (dot) com
(Remove .AXSPAMGN for email)
 
Reply With Quote
 
 
 
 
Chris Ianson
Guest
Posts: n/a
 
      03-10-2006
"Jim Moe" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> Chris Ianson wrote:
>> Hi, I'm looking for a simple newbie way to put quotes into HTML code, and
>> have them randomise each time the page is refreshed. What's the easy
>> solution?
>>

> Client-side: use Javascript. Server-side: use PHP, JSP, perl, etc.
> Open a file of quotes, use a random number generator to select a line of
> text, print it.


Sorry, can you show me an example in Java please, with say 2 quotes. I have
no idea what any of that means :S

Thanks!

>
> --
> jmm (hyphen) list (at) sohnen-moe (dot) com
> (Remove .AXSPAMGN for email)



 
Reply With Quote
 
Mitja Trampus
Guest
Posts: n/a
 
      03-10-2006
Chris Ianson wrote:
> "Jim Moe" <(E-Mail Removed)> wrote in message
> news:(E-Mail Removed)...
>> Chris Ianson wrote:
>>> Hi, I'm looking for a simple newbie way to put quotes into HTML code, and
>>> have them randomise each time the page is refreshed. What's the easy
>>> solution?
>>>

>> Client-side: use Javascript. Server-side: use PHP, JSP, perl, etc.
>> Open a file of quotes, use a random number generator to select a line of
>> text, print it.

>
> Sorry, can you show me an example in Java please, with say 2 quotes.


Java and JavaScript are two entirely different things. Java is in fact hidden in the "JSP"
above - Java Server Pages.

> I have
> no idea what any of that means :S


Then no example can help you (enough). The easiest (though shoddiest) way to go is
JavaScript; you can find a script on Google with instruction on how to put it on your
site, requiring no knowledge of what is actually going on.
 
Reply With Quote
 
Chris Ianson
Guest
Posts: n/a
 
      03-11-2006
"Mitja Trampus" <(E-Mail Removed)> wrote in message
news:aTnQf.794$(E-Mail Removed)...
> Chris Ianson wrote:
>> "Jim Moe" <(E-Mail Removed)> wrote in message
>> news:(E-Mail Removed)...
>>> Chris Ianson wrote:
>>>> Hi, I'm looking for a simple newbie way to put quotes into HTML code,
>>>> and
>>>> have them randomise each time the page is refreshed. What's the easy
>>>> solution?
>>>>
>>> Client-side: use Javascript. Server-side: use PHP, JSP, perl, etc.
>>> Open a file of quotes, use a random number generator to select a line
>>> of
>>> text, print it.

>>
>> Sorry, can you show me an example in Java please, with say 2 quotes.

>
> Java and JavaScript are two entirely different things. Java is in fact
> hidden in the "JSP" above - Java Server Pages.
>
> > I have
>> no idea what any of that means :S

>
> Then no example can help you (enough). The easiest (though shoddiest) way
> to go is JavaScript; you can find a script on Google with instruction on
> how to put it on your site, requiring no knowledge of what is actually
> going on.


Yes, I have found some JaveScripts, but even though I copy and paste them
exactly I still get script errors in IE6.

Perhaps someone can post a working example here with 2 quotes?


 
Reply With Quote
 
Jonathan N. Little
Guest
Posts: n/a
 
      03-11-2006
Chris Ianson wrote:
<snip>
>
> Yes, I have found some JaveScripts, but even though I copy and paste them
> exactly I still get script errors in IE6.
>
> Perhaps someone can post a working example here with 2 quotes?
>
>


help yourself!


http://www.google.com/search?hl=en&l...ay&btnG=Search
javascript random quote of the day - Google Search
--
Take care,

Jonathan
-------------------
LITTLE WORKS STUDIO
http://www.LittleWorksStudio.com
 
Reply With Quote
 
Chris Ianson
Guest
Posts: n/a
 
      03-11-2006
"Jonathan N. Little" <(E-Mail Removed)> wrote in message
news:44122921$0$25074$(E-Mail Removed). ..
> Chris Ianson wrote:
> <snip>
>>
>> Yes, I have found some JaveScripts, but even though I copy and paste them
>> exactly I still get script errors in IE6.
>>
>> Perhaps someone can post a working example here with 2 quotes?

>
> help yourself!
>
>
> http://www.google.com/search?hl=en&l...ay&btnG=Search
> javascript random quote of the day - Google Search


All very well but these are mainly links to other people's quotes (I want my
own). Then there are scripts which are either dead links, or PHP (I need
JavaScript), or just plain don't work.

Is anybody here able to paste a small bit of HTML to a reply that will
enable me to add my own random text to be displayed on each screen refresh?

Thanks if you can.

> --
> Take care,
>
> Jonathan
> -------------------
> LITTLE WORKS STUDIO
> http://www.LittleWorksStudio.com



 
Reply With Quote
 
Toby Inkster
Guest
Posts: n/a
 
      03-11-2006
Chris Ianson wrote:

> Hi, I'm looking for a simple newbie way to put quotes into HTML code, and
> have them randomise each time the page is refreshed. What's the easy
> solution?


If your server supports PHP...

<?php
$cmd = '/usr/games/fortune';
printf("<blockquote><p>%s</p></blockquote>",
nl2br(htmlspecialchars(system($cmd))));
?>

--
Toby A Inkster BSc (Hons) ARCS
Contact Me ~ http://tobyinkster.co.uk/contact

 
Reply With Quote
 
Chris Ianson
Guest
Posts: n/a
 
      03-11-2006
"Toby Inkster" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)5n.co.uk...
> Chris Ianson wrote:
>
>> Hi, I'm looking for a simple newbie way to put quotes into HTML code, and
>> have them randomise each time the page is refreshed. What's the easy
>> solution?

>
> If your server supports PHP...
>
> <?php
> $cmd = '/usr/games/fortune';
> printf("<blockquote><p>%s</p></blockquote>",
> nl2br(htmlspecialchars(system($cmd))));
> ?>


Thanks. What if it doesn't support PHP (it doesn't)?

>
> --
> Toby A Inkster BSc (Hons) ARCS
> Contact Me ~ http://tobyinkster.co.uk/contact
>



 
Reply With Quote
 
Chris Ianson
Guest
Posts: n/a
 
      03-11-2006
PS: I would also like it to not only display a random phrase on first page
load, but to also display a random one every 15 seconds.


 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Math.random() and Math.round(Math.random()) and Math.floor(Math.random()*2) VK Javascript 15 05-02-2010 03:43 PM
random.random(), random not defined!? globalrev Python 4 04-20-2008 08:12 AM
Asp.NET Javascript string, want to pass '(single quotes' within '(single quotes) Chris ASP .Net 1 03-24-2006 09:03 PM
Quotes/Double Quotes in Image Control Chris White ASP .Net 1 09-22-2004 06:22 AM
Multiline quotes - escaping quotes - et al Lawrence Tierney Java 3 12-24-2003 05:12 PM



Advertisments