Click to See Complete Forum and Search --> : Help with "Daily Quote", please


Drdsr
09-02-2003, 01:50 AM
Hey there...

I'm trying to impliment the code found at this address:

http://javascript.internet.com/cale...dar-quotes.html

(I'll post the code below)

Anyway, all I get is a page that gives:

the current date
~ Author ~
Free JavaScripts provided
by The JavaScript Source


No quotes! Any help would be hugely appreciated!

Drdsr
09-02-2003, 02:11 AM
The code I'm using (truncated; it was too long to post; I deleted several months, but they are included in my code):

<HTML>
<!--This file created 11:57 PM 9/1/03 by Claris Home Page version 3.0-->
<HEAD>
<META NAME=GENERATOR CONTENT="Claris Home Page 3.0">
<X-CLARIS-WINDOW TOP=0 BOTTOM=604 LEFT=0 RIGHT=1020>
<X-CLARIS-TAGVIEW MODE=minimal>
<SCRIPT LANGUAGE="JavaScript"><!-- This script and many more are available free online at --><!-- The JavaScript Source!! http://javascript.internet.com --><!-- Original: Peg Duggan (pegduggan@hotmail.com) --><!-- Begin
dayName = new Array ("Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday")
monName = new Array ("January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December")
now = new Date

Jan = new Array
Jan[1] = "Place quote here"
Jan[2] = "Place quote here"
Jan[3] = "Place quote here"
Jan[4] = "Place quote here"
Jan[5] = "Place quote here"
Jan[6] = "Place quote here"
Jan[7] = "Place quote here"
Jan[8] = "Place quote here"
Jan[9] = "Place quote here"
Jan[10] = "Place quote here"
Jan[11] = "Place quote here"
Jan[12] = "Place quote here"
Jan[13] = "Place quote here"
Jan[14] = "Place quote here"
Jan[15] = "Place quote here"
Jan[16] = "Place quote here"
Jan[17] = "Place quote here"
Jan[18] = "Place quote here"
Jan[19] = "Place quote here"
Jan[20] = "Place quote here"
Jan[21] = "Place quote here"
Jan[22] = "Place quote here"
Jan[23] = "Place quote here"
Jan[24] = "Place quote here"
Jan[25] = "Place quote here"
Jan[26] = "Place quote here"
Jan[27] = "Place quote here"
Jan[28] = "Place quote here"
Jan[29] = "Place quote here"
Jan[30] = "Place quote here"
Jan[31] = "Place quote here"

Dec = new Array
Dec[1] = "Place quote here"
Dec[2] = "Place quote here"
Dec[3] = "Place quote here"
Dec[4] = "Place quote here"
Dec[5] = "Place quote here"
Dec[6] = "Place quote here"
Dec[7] = "Place quote here"
Dec[8] = "Place quote here"
Dec[9] = "Place quote here"
Dec[10] = "Place quote here"
Dec[11] = "Place quote here"
Dec[12] = "Place quote here"
Dec[13] = "Place quote here"
Dec[14] = "Place quote here"
Dec[15] = "Place quote here"
Dec[16] = "Place quote here"
Dec[17] = "Place quote here"
Dec[18] = "Place quote here"
Dec[19] = "Place quote here"
Dec[20] = "Place quote here"
Dec[21] = "Place quote here"
Dec[22] = "Place quote here"
Dec[23] = "Place quote here"
Dec[24] = "Place quote here"
Dec[25] = "Place quote here"
Dec[26] = "Place quote here"
Dec[27] = "Place quote here"
Dec[28] = "Place quote here"
Dec[29] = "Place quote here"
Dec[30] = "Place quote here"
Dec[31] = "Place quote here"
// End --></script>
</HEAD>
<BODY BGCOLOR="#FFFFFF">
<P>&nbsp;</P>

<P><SCRIPT LANGUAGE=JavaScript><!-- This script and many more are available free online at --><!-- The JavaScript Source!! http://javascript.internet.com --><!-- Begin
document.write("<Font color=#333366>")
document.write("<center><B><I>" + dayName[now.getDay()] + ", " + monName[now.getMonth()] + " " + now.getDate() + ", " + now.getFullYear() + ".</I></B></center><BR>" )
document.write("<Font size=5>")
if (now.getMonth() == 0) document.write("<center><i>");" + Jan[now.getDate()] + ";"</i></center>";
if (now.getMonth() == 1) document.write("<center><i>");" + Feb[now.getDate()] + ";"</i></center>";
if (now.getMonth() == 2) document.write("<center><i>");" + Mar[now.getDate()] + ";"</i></center>";
if (now.getMonth() == 3) document.write("<center><i>");" + Apr[now.getDate()] + ";"</i></center>";
if (now.getMonth() == 4) document.write("<center><i>");" + May[now.getDate()] + ";"</i></center>";
if (now.getMonth() == 5) document.write("<center><i>");" + Jun[now.getDate()] + ";"</i></center>";
if (now.getMonth() == 6) document.write("<center><i>");" + Jul[now.getDate()] + ";"</i></center>";
if (now.getMonth() == 7) document.write("<center><i>");" + Aug[now.getDate()] + ";"</i></center>";
if (now.getMonth() == 8) document.write("<center><i>");" + Sep[now.getDate()] + ";"</i></center>";
if (now.getMonth() == 9) document.write("<center><i>");" + Oct[now.getDate()] + ";"</i></center>";
if (now.getMonth() == 10) document.write("<center><i>");" + Nov[now.getDate()] + ";"</i></center>";
if (now.getMonth() == 11) document.write("<center><i>");" + Dec[now.getDate()] + ";"</i></center>";
document.write("</Font>")
document.write("<P align=center><B><I>~ Author ~</I></B></P>")
document.write("</Font>")
// End --></SCRIPT></P>

<CENTER><FONT FACE="arial, helvetica">Free JavaScripts provided<BR>
by </FONT><A HREF="http://javascriptsource.com"><FONT FACE="arial, helvetica">The
JavaScript Source</FONT></A></CENTER>

<P><!-- Script Size: 13.98 KB --></P>
</BODY>
</HTML>

cul8er23
09-02-2003, 02:47 AM
Hi,
first thing there is nothing like that in your script:
------------------
arrayIndex = now.getDay();
arrayName = monName[now.getMonth()].substring(0,3);
alert(arrayName);
todaysQuote = eval(arrayName+"["+arrayIndex+"]");

by that you get todays quote (change the 'Jan' array to 'Sep'!)

secondly you will have to write that to your doc:
------------------
document.write("<P align=center><B>"+todaysQuote+"</B></P>") ;

In short everything you needed to was entirely missing.

Hope I could help

Cheers
Fab

Drdsr
09-02-2003, 02:55 AM
O.K...does it matter where I put it? (body/head, etc)

cul8er23
09-02-2003, 02:58 AM
Check out my attachement in the last quote.
It'all there.

Drdsr
09-02-2003, 03:10 AM
Fantastic! Thanks much--now one more question:

Each time I load the page, a box with a (!) comes up, says "Sep", and has the O.K. button. How do I get rid of that?

cul8er23
09-02-2003, 03:23 AM
OOops,
I used the alert() method to find out if the substring() method has the right params (0,3) // first 3 chars of the month(from array).

Find the line and get rid of it :D

Drdsr
09-02-2003, 03:27 AM
Originally posted by cul8er23
OOops,
I used the alert() method to find out if the substring() method has the right params (0,3) // first 3 chars of the month(from array).

Find the line and get rid of it :D

LOL! That's all greek to me--I've got no idea what you just said!

cul8er23
09-02-2003, 03:42 AM
Get rid of that line:
alert(arrayName);

There a lot of books on Javascript, might whant to read one :o

Drdsr
09-02-2003, 03:45 AM
Yes, I'm definitely an infant taking his first steps into the world of JS. Thank you so much for your help!

cul8er23
09-02-2003, 03:47 AM
You're welcome