Question
QUOTE OF THE DAY not totally working in JAVA I need to fix this code, the problem that I have is that I have to
QUOTE OF THE DAY not totally working in JAVA
I need to fix this code, the problem that I have is that I have to include before the listed quotes , one of the quotes and the date and later are the listed quotes. Now when I run it , it only shows the title and the list of quotes. I have been trying to figure out the problem, any help...?
I need it to run
the title "Quote of the Day"
then a randon quote
then the date
and then the list of all the quotes, here is the code
JSJQ QUOTES and Date File
Quote of the Day
All the quotes:
this is what I have fo now...
//************************************************************ // 1: define variables for today's date, //************************************************************ var today = new Date(); var day = today.getDate(); var month = today.getMonth(); var year = today.getFullYear();
//************************************************************ // 2: define an array to hold the day names //************************************************************ var monthArray = new Array();
monthArray[0] = "January"; monthArray[1] = "February"; monthArray[2] = "March"; monthArray[3] = "April"; monthArray[4] = "May"; monthArray[5] = "June"; monthArray[6] = "July"; monthArray[7] = "August"; monthArray[8] = "September"; monthArray[9] = "October"; monthArray[10] = "November"; monthArray[11] = "December";
var dayArray = new Array();
dayArray[0] = "Monday"; dayArray[1] = "Tuesday"; dayArray[2] = "Wednesday"; dayArray[3] = "Thursday"; dayArray[4] = "Friday"; dayArray[5] = "Saturday"; dayArray[6] = "Sunday";
//************************************************************ // 3: define an array to hold the daily quotes //************************************************************
var quoteArray = new Array();
quoteArray[0] = "Nothing is impossible, the word itself says 'I'm possible'!-Audrey Hepburn"; quoteArray[1] = "The best preparation for tomorrow is doing your best today.-H. Jackson Brown, Jr"; quoteArray[2] = "Try to be a rainbow in someone's cloud.-Maya Angelou"; quoteArray[3] = "If opportunity doesn't knock, build a door.-Milton Berle"; quoteArray[4] = "People won't have time for you if you are always angry or complaining.-Stephen Hawking"; quoteArray[5] ="Realize deeply that the present moment is all you have. Make the now the primary focus of your life.-Eckhart Tolle" quoteArray[6] = "When you judge another, you do not define them, you define yourself.-Wayne Dyer"; quoteArray[7] = "Dont wish it were easier. Wish you were better.-Jim Rohn"; quoteArray[8] = "Just remember that Dumbo didnt need the feather; the magic was in him.-Stephen King"; quoteArray[9] = "Logic is the beginning of wisdom, not the end.- Mr.Spock Star Trek ";
//************************************************************ // 4: loop through all of the quotes // and write the quotes to the page. Use DOM methods or innerHTML // to write to the page. //************************************************************ function allQuotes() {
var allQuotes = document.getElementById('quotes');
for (var i = 0; i < quoteArray.length; i++) {
var text = document.createTextNode(quoteArray[i]); var br = document.createElement('br');
allQuotes.appendChild(text); allQuotes.appendChild(br); }
quoteOfTheDay(); }
//************************************************************ // 5: create a window.onload function to format and display // the current day name. // // Display the quote for the day. // // //************************************************************
function quoteOfTheDay() { document.getElementById('quote_of_the_day').firstChild.nodeValue = quoteArray[today.getDay()-1];
document.getElementById('date').firstChild.nodeValue = dayArray[day] + ", " + monthArray[month] + day + ", " + year; }
window.onload = allQuotes;
Quote of the Day
All the quotes:
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started