27 lines
No EOL
1.1 KiB
JavaScript
27 lines
No EOL
1.1 KiB
JavaScript
const quotes = [{
|
||
quote: `"wesh mgl"`,
|
||
writer: `– PD-nim`,
|
||
image: "https://encrypted-tbn1.gstatic.com/images?q=tbn:ANd9GcSUm29nme3KHFOHSTY2zDwOs3NIHdxeajrCS0_JIminji34YL-x"
|
||
}, {
|
||
quote: `"겨울이 지나면 다시 봄은 오는 거야 <br>
|
||
Once the winter passes, the spring will come again""`,
|
||
writer: `– BTS (Answer: Love Myself)`,
|
||
image: "https://upload.wikimedia.org/wikipedia/en/e/e2/BTS%2C_Love_Yourself_Answer%2C_album_cover.jpg"
|
||
}, {
|
||
quote: `"최선을 넌 다했을 뿐이야 <br> All you did was just to do your best "`,
|
||
writer: `– RM in No.2 (with parkjiyoon)`,
|
||
image: "https://media.cdnws.com/_i/209718/8099/376/0/rm-bts-indigo-book-edition-cover.jpeg"
|
||
}]
|
||
|
||
let btn = document.querySelector("#Qbtn");
|
||
let quote = document.querySelector(".quote");
|
||
let writer = document.querySelector(".writer");
|
||
let image = document.querySelector(".img");
|
||
|
||
btn.addEventListener("click", function() {
|
||
let random = Math.floor(Math.random() * quotes.length);
|
||
|
||
quote.innerHTML = quotes[random].quote;
|
||
writer.innerHTML = quotes[random].writer;
|
||
image.src = quotes[random].image;
|
||
}); |