File tree Expand file tree Collapse file tree 3 files changed +40
-14
lines changed
Expand file tree Collapse file tree 3 files changed +40
-14
lines changed Original file line number Diff line number Diff line change 88 < link rel ="stylesheet " href ="style.css " />
99 </ head >
1010 < body >
11- < h1 > hello there</ h1 >
12- < p id ="quote "> </ p >
13- < p id ="author "> </ p >
11+ < div id ="quote-container ">
12+ < h1 > Quote Generator</ h1 >
1413
15- < button type ="button " id ="new-quote "> New quote</ button >
16- < input id ="quote-input " type ="text " placeholder ="Enter a quote here " />
17- < input id ="author-input " type ="text " placeholder ="Enter the author here " />
14+ < p id ="quote "> </ p >
15+ < p id ="author "> </ p >
1816
19- < button type ="button " id ="add -quote "> Add quote</ button >
20-
17+ < button type ="button " id ="new -quote "> New quote</ button >
18+ </ div >
2119 </ body >
2220</ html >
Original file line number Diff line number Diff line change 1+ const quoteElement = document . getElementById ( "quote" ) ;
2+ const authorElement = document . getElementById ( "author" ) ;
3+ const newQuoteButton = document . getElementById ( "new-quote" ) ;
4+
5+ function showQuote ( quoteObject ) {
6+ quoteElement . textContent = quoteObject . quote ;
7+ authorElement . textContent = quoteObject . author ;
8+ }
9+
10+ function showRandomQuote ( ) {
11+ const randomQuote = pickFromArray ( quotes ) ;
12+ showQuote ( randomQuote ) ;
13+ }
14+
15+ window . addEventListener ( "load" , function ( ) {
16+ showRandomQuote ( ) ;
17+
18+ newQuoteButton . addEventListener ( "click" , function ( ) {
19+ showRandomQuote ( ) ;
20+ } ) ;
21+ } ) ;
22+
123// DO NOT EDIT BELOW HERE
224
325// pickFromArray is a function which will return one item, at
Original file line number Diff line number Diff line change 11/** Write your CSS in here **/
22body {
33 font-family : Arial, sans-serif;
4- background-color : # f0f0f0 ;
4+ background-color : burlywood ;
55 padding : 20px ;
66}
77
1212 box-shadow : 0 2px 5px rgba (0 , 0 , 0 , 0.1 );
1313 max-width : 600px ;
1414 margin : auto;
15+ text-align : center;
1516}
1617# quote {
1718 font-size : 24px ;
@@ -20,19 +21,24 @@ body {
2021}
2122# author {
2223 font-size : 20px ;
23- text-align : right ;
24+ text-align : center ;
2425 margin-bottom : 20px ;
26+ color : # 555 ;
2527}
2628button {
29+ background-color : # 007BFF ;
30+ color : white;
2731 padding : 10px 20px ;
2832 font-size : 16px ;
2933 cursor : pointer;
3034}
31- # quote-input , # author-input {
32- padding : 10 px ;
33- font-size : 16 px ;
34- margin-right : 10 px ;
35+
36+ h1 {
37+ color : # 333 ;
38+ margin-bottom : 20 px ;
3539}
3640
3741
3842
43+
44+
You can’t perform that action at this time.
0 commit comments