Reply
How Do You Make 'Quote Of The Day' Script...Quote Of The Day?
Old 07-27-2006, 01:42 PM How Do You Make 'Quote Of The Day' Script...Quote Of The Day?
KRYPTOR's Avatar
Skilled Talker

Posts: 62
Name: Ray
Location: Illinois
I am flustered on this 'Quote Of The Day' Script.

I want to make it a DAILY, 24 hour script that CHANGES the script to the VERY NEXT ONE in line. I want it set to MY TIMEZONE of Central Standard Time, (GMT -6:00).

So far I have this script which RANDOMLY thows out a different script each time you
reset this page...I don't want RANDOM I want ORDER 1,2,3,4 and so on in ORDER.

Here's a demo script with 3 quotes out of 30 that I have.

<SCRIPT language=JavaScript>

var quotes=new Array()
quotes[0]="<i>If the facts don't fit the theory, change the facts.</i><BR><font color=#000000>- Albert Einstein</font>"
quotes[1]="<i>It's not the hours you put in your work that counts, it's the work you put in the hours.</i><BR><font color=#000000>- Sam Ewing</font>"
quotes[2]="<i>Pleasure in the job puts perfection in the work.</i><BR><font color=#000000>- Aristotle</font>"
quotes[3]="<i>When a man tells you that he got rich through hard work,<BR>ask him: Whose?</i><BR><font color=#000000>- Don Marquis</font>"
var whichquote=Math.floor(Math.random()*(quotes.length ))

</script>

<BODY>
<script>
document.write("<font face=arial size=4 color=#ffffff><B>" + (quotes[whichquote]) + "</B></font>")
</script>
</BODY>

Should I add the first line below to mean 24 hours? How would I complete it?
Should I add the second line below to give order instead?

var interval = 7.5; // for time?
var random_display = 1; // 0 = no, 1 = yes

Thanks!
KRYPTOR
__________________
"What is SEEN is TEMPORAL, What is UNSEEN is ETERNAL".

Exotic And Rare Plants!

Last edited by KRYPTOR : 07-27-2006 at 01:44 PM.
KRYPTOR is offline
Reply With Quote
View Public Profile Visit KRYPTOR's homepage!
 
When You Register, These Ads Go Away!
Old 07-28-2006, 09:52 PM Re: How Do You Make 'Quote Of The Day' Script...Quote Of The Day?
funkdaddu's Avatar
Web Design Snob

Posts: 636
Are you saying you want a different quote for each hour? Can you make your array 24 quotes in length then just use:
Code:
var theDate = new Date();
document.getElementById("targetDIV").innerHTML = quotes[theDate.getHours()];

Last edited by funkdaddu : 07-28-2006 at 09:55 PM.
funkdaddu is offline
Reply With Quote
View Public Profile Visit funkdaddu's homepage!
 
Old 07-28-2006, 10:16 PM Re: How Do You Make 'Quote Of The Day' Script...Quote Of The Day?
KRYPTOR's Avatar
Skilled Talker

Posts: 62
Name: Ray
Location: Illinois
funkdaddu

Thanks for your response!

I am wanting 1 quote in a 24 hour period ie 1 per day in sequential order,
quotes(0)
quotes(1) etc...

Can I still use your below script for this??

Also will this same script work for calling up URL files for images???jpeg's or gifs from
another site???

images[0]
images[1] etc...???

Thanks!
The KRYPTOR
__________________
"What is SEEN is TEMPORAL, What is UNSEEN is ETERNAL".

Exotic And Rare Plants!
KRYPTOR is offline
Reply With Quote
View Public Profile Visit KRYPTOR's homepage!
 
Old 07-28-2006, 10:26 PM Re: How Do You Make 'Quote Of The Day' Script...Quote Of The Day?
funkdaddu's Avatar
Web Design Snob

Posts: 636
You would have to make 31 quotes, one for each day of the month, then use quotes[theDate.getDate()-1]; it should work for images too.
funkdaddu is offline
Reply With Quote
View Public Profile Visit funkdaddu's homepage!
 
Old 07-29-2006, 12:32 AM Re: How Do You Make 'Quote Of The Day' Script...Quote Of The Day?
KRYPTOR's Avatar
Skilled Talker

Posts: 62
Name: Ray
Location: Illinois
Thanks funkdaddu

I'll try this out for size.

But very script I find out there has the line for random quote.

Like var whichquote=Math.floor(Math.random()*(quotes.length ))

How would I change the above variable so that random isn't in it?

I just want a sequenced 0-31 in order, not random.

Thanks!
The KRYPTOR
__________________
"What is SEEN is TEMPORAL, What is UNSEEN is ETERNAL".

Exotic And Rare Plants!
KRYPTOR is offline
Reply With Quote
View Public Profile Visit KRYPTOR's homepage!
 
Old 07-29-2006, 12:43 AM Re: How Do You Make 'Quote Of The Day' Script...Quote Of The Day?
funkdaddu's Avatar
Web Design Snob

Posts: 636
That's what the quotes[theDate.getDate()] is for. If it's the 13th, it uses the 13th quote in the array, and so on. It's the simplest way to do what you're talking about. For every day of the month there will be a different quote. Just make 31 entries into the quotes array and it will work.

If you want it starting at quote 1 for each person, the first time they visit, then for each day go to quote 2 the next, etc, you're going to need to get way more complex - writing cookies to the person's browsers containing the current quote & the date. Then check every time the page is loaded if the date is greater than today, then add 1 to the quote number and show the quote, otherwise just show the current number. It's possible, but IMHO, for something as trivial as a quote of the day thing, it seems like a lot of work.
funkdaddu is offline
Reply With Quote
View Public Profile Visit funkdaddu's homepage!
 
Old 07-29-2006, 12:24 PM Re: How Do You Make 'Quote Of The Day' Script...Quote Of The Day?
KRYPTOR's Avatar
Skilled Talker

Posts: 62
Name: Ray
Location: Illinois


ROFLMAO! funkdaddu

You're right! I'd say screw it and just give them a quote!

The cookie thing is too complex and besides if they were like me, I CLEAN my computer
including cookies regularly.

But you've helped me out tremendously!

I am limited in javascript like MANY other people here locally are.

I'm tempted to take a course in it because it can be very useful as it has been proven to be here.

Thanks Again funkdaddu!

THE KRYPTOR
__________________
"What is SEEN is TEMPORAL, What is UNSEEN is ETERNAL".

Exotic And Rare Plants!
KRYPTOR is offline
Reply With Quote
View Public Profile Visit KRYPTOR's homepage!
 
Reply     « Reply to How Do You Make 'Quote Of The Day' Script...Quote Of The Day?
 

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

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




   
RSS Feed  Feeds: RSS   JS   XML
RSS Feed  Feeds for this forum: RSS   JS   XML

 


Page generated in 0.14818 seconds with 12 queries