Page 319 - Web Applications (803) Class 12
P. 319

quote: “In the end, we will remember not the words of our enemies,
                                but the silence of our friends.”,
                             author: “Martin Luther King Jr.”

                         },
                         {

                             quote: “The best way to predict the future is to create it.”,
                             author: “Peter Drucker”
                         }
                     ];

                     const quoteElement = document.getElementById(‘quote’);
                     const authorElement = document.getElementById(‘author’);

                     const newQuoteButton = document.getElementById(‘new-quote’);
                     function getRandomQuote() {
                         const randomIndex = Math.floor(Math.random() * quotes.length);
                         return quotes[randomIndex];

                     }
                     function displayQuote() {

                         const randomQuote = getRandomQuote();
                         quoteElement.textContent = randomQuote.quote;
                         authorElement.textContent = `- ${randomQuote.author}`;

                     }
                     newQuoteButton.addEventListener(‘click’, displayQuote);
                     // Display an initial quote when the page loads

                     displayQuote();
                 PROJECT 10


                 A simple ecommerce website using HTML, CSS and JavaScript.



























                                                                                                          Projects   317
   314   315   316   317   318   319   320   321   322   323   324