<body>
<form class="hidden" id="login-form">
<input
required
maxlength="15"
type="text"
placeholder="what is your name?" />
<button>Log In</button>
</form>
<h2 id="clock">00:00:00</h2>
<h1 class="hidden" id="greeting"></h1>
<div id="quote">
<span></span>
<span></span>
</div>
</body>
// quotes.js
const quotes = [
{
quote: "삶이 있는 한 희망은 있다.",
author: "Marcus Tullius Cicero"
},
{
quote: "산다는것 그것은 치열한 전투이다.",
author: "Romain Rolland"
},
{
quote: "많은 시간을 소비하면서 인생을 어떻게 보낼 것인가를 고민할 만큼 인생은 그리 길지 않다.",
author: "Samuel Johnson"
},
{
quote: "진정으로 웃으려면 고통을 참아야하며 , 나아가 고통을 즐길 줄 알아야 해.",
author: "Charlie Chaplin"
},
{
quote: "직업에서 행복을 찾아라. 아니면 행복이 무엇인지 절대 모를 것이다.",
author: "Elbert Hubbard"
},
{
quote: "행복의 한 쪽 문이 닫히면 다른 쪽 문이 열린다.",
author: "Helen Keller"
},
{
quote: "피할 수 없으면 즐겨라.",
author: "Robert Elliott Speer"
},
{
quote: "고통이 남기고 간 뒤를 보라! 고난이 지나면 반드시 기쁨이 스며든다. ",
author: "Goethe"
},
{
quote: "고개 숙이지 마십시오. 세상을 똑바로 정면으로 바라보십시오.",
author: " Helen Keller"
},
{
quote: "당신이 할수 있다고 믿든 할수 없다고 믿든 믿는 대로 될것이다.",
author: "Henry Ford,"
},
]
const quote = document.querySelector("#quote span:first-child");
const author = document.querySelector("#quote span:last-child");
function randomQuote() {
quote.innerText = quotes[Math.floor(Math.random() * quotes.length)].quote;
author.innerText = quotes[Math.floor(Math.random() * quotes.length)].author;
}
randomQuote();
// background.js
const images = [
"0.jpg",
"1.jpg",
"2.jpg",
"3.jpg",
]
const bgImg = document.createElement("img");
const randomImg = images[Math.floor(Math.random()*images.length)];
bgImg.src = `./img/${randomImg}`;
document.body.appendChild(bgImg);