Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 21 additions & 0 deletions Quote of Day Generator/quotes.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
div {
text-align: center;
}

h1 {
font-size: 80px;
font-family: Impact;
}
button {
width: 250px;
height: 80px;
background-color: green;
color: darkred;
}
p {
font-size: 35px;
}

button:hover {
background-color: hotpink;
}
25 changes: 25 additions & 0 deletions Quote of Day Generator/quotes.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
<!DOCTYPE html>
<html>
<head>
<link rel="stylesheet" type="text/css" href="quotes.css">
</head>
<body style="background-color:powderblue;">

<div>
<h1>Quote of the Day-Morning Everyone!!!</h1>
<p>Please press the button below to recieve a random quote!</p>

<button onclick="generateQuote();">New Quote of the day is:</button>
<div>
<p id="quoteOutput"></p> <!--The quote will be outputted to here-->

<p id="authorOutput"></p> <!-- The author will be put here-->
</div>

</div>

<script src ="quotes.js"> </script>

</body>

</html>
64 changes: 64 additions & 0 deletions Quote of Day Generator/quotes.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
var arrayOfQuotes = [

{
"author":"Jim Rohn",
"quote":"Beware of what you become in pursuit of what you want."
},
{
"author": "Epictetus",
"quote":"It's not what happens to you,but how you react to it that matters."
},
{
"author" :"Frank Sinatra",
"quote": "The best revenge is massive success."
},
{
"author": "Wayne Gretzy",
"quote": "You miss 100% of the shots you don't take."
},
{
"author" :"Nelson Mandela",
"quote":"Resentment is like drinking poison and waiting for your enemies to die."
},

{
"author":"Confucius",
"quote": "Silence is a true friend who never betrays."

},
{
"author": "Elbert Hubbard",
"quote":"Do not take life too seriously. You will not get out alive."

},
{
"author":"Lyndon B.Johnson",
"quote": "Yesterday is not ours to recover,but tomorrow is ours to win or lose."

},
{
"author":"Henrik Ibsen",
"quote": "A thousand words can not leave the same deep impression as a single deed."

},
{
"author": "Katherine Pearson",
"quote": "A dream without a plan is nothing more than a wish"
}


]

function randomSelector(arrayLength) {
return Math.floor(Math.random() * arrayLength);
}

function generateQuote() {

var randomNumber = randomSelector(arrayOfQuotes.length);

document.getElementById("quoteOutput").innerHTML = '"' + arrayOfQuotes[randomNumber].quote + '"';

document.getElementById("authorOutput").innerHTML = "- " + arrayOfQuotes[randomNumber].author;

}