Create script.js
Browse files
script.js
ADDED
|
@@ -0,0 +1,69 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
const questions = [
|
| 2 |
+
"μλ‘μ΄ μ¬λλ€κ³Ό μ½κ² μ΄μΈλ¦¬λμ?",
|
| 3 |
+
"μΈλΆμ¬νλ³΄λ€ ν° κ·Έλ¦Όμ λ³΄λ €κ³ νλμ?",
|
| 4 |
+
"λ
Όλ¦¬μ μ΄κ³ κ°κ΄μ μΈ κ²°μ μ λ΄λ¦¬λ €κ³ νλμ?",
|
| 5 |
+
"μΌμ μ μ κ³ννκ³ λ°λ₯΄λ νΈμΈκ°μ?",
|
| 6 |
+
"λ€μν κ°λ₯μ±μ μμνλ©° μκ°νλ κ²μ μ’μνλμ?",
|
| 7 |
+
"μλλ°©μ κ°μ μ λ―Όκ°νκ°μ?",
|
| 8 |
+
"μ¦ν₯μ μΌλ‘ νλνλ κ²μ μ¦κΈ°λμ?",
|
| 9 |
+
"λν μ€ μμ μ΄ λ§λ³΄λ€ μλλ°©μ λ§μ λ λ§μ΄ λ£λμ?",
|
| 10 |
+
"λ―Έλμ κ°λ₯μ±λ³΄λ€ νμ¬μ μ¬μ€μ μ§μ€νλμ?",
|
| 11 |
+
"κ°λ± μν©μμ μ¬λλ€μ μ‘°νλ₯Ό μ°μ μνλμ?",
|
| 12 |
+
"νΌμλ§μ μκ°μ μ€μνκ² μκ°νλμ?",
|
| 13 |
+
"μμ μ κ°μ μ μ νννλμ?",
|
| 14 |
+
"볡μ‘ν λ¬Έμ λ₯Ό λ
Όλ¦¬μ μΌλ‘ λΆμνλ κ²μ μ¦κΈ°λμ?",
|
| 15 |
+
"κ·μΉκ³Ό μ μ°¨λ₯Ό λ°λ₯΄λ κ²μ μ νΈνλμ?",
|
| 16 |
+
"μλ‘μ΄ νκ²½μμ λΉ λ₯΄κ² μ μνλμ?",
|
| 17 |
+
"μΈλΆμ¬νλ³΄λ€ ν° κ·Έλ¦Όμ λ μ§μ€νλμ?",
|
| 18 |
+
"λ€λ₯Έ μ¬λμ κ°μ μ 곡κ°νλ νΈμΈκ°μ?",
|
| 19 |
+
"λ§κ° μκ° μ μ μΌμ λλ΄λ κ²μ μ€μνκ² μκ°νλμ?",
|
| 20 |
+
"μ¬λλ€κ³Όμ κ΄κ³κ° μμ μκ² μ€μνκ°μ?",
|
| 21 |
+
"μμ μ μ견μ ννν λ λ
Όλ¦¬μ μΈ μ΄μ λ₯Ό μ€μνλμ?",
|
| 22 |
+
"μ€μ κ²½νμ ν΅ν΄ λ°°μ°λ κ²μ μ νΈνλμ?",
|
| 23 |
+
];
|
| 24 |
+
|
| 25 |
+
let currentQuestion = 0;
|
| 26 |
+
let answers = [];
|
| 27 |
+
|
| 28 |
+
function selectAnswer(answer) {
|
| 29 |
+
answers.push(answer);
|
| 30 |
+
currentQuestion++;
|
| 31 |
+
if (currentQuestion < questions.length) {
|
| 32 |
+
showQuestion();
|
| 33 |
+
} else {
|
| 34 |
+
showResult();
|
| 35 |
+
}
|
| 36 |
+
}
|
| 37 |
+
|
| 38 |
+
function showQuestion() {
|
| 39 |
+
document.getElementById("question-text").textContent = questions[currentQuestion];
|
| 40 |
+
document.getElementById("question-number").textContent = currentQuestion + 1;
|
| 41 |
+
}
|
| 42 |
+
|
| 43 |
+
function showResult() {
|
| 44 |
+
const resultContainer = document.getElementById("result-container");
|
| 45 |
+
const questionContainer = document.getElementById("question-container");
|
| 46 |
+
questionContainer.classList.add("hidden");
|
| 47 |
+
resultContainer.classList.remove("hidden");
|
| 48 |
+
|
| 49 |
+
// κ²°κ³Ό κ³μ° λ‘μ§
|
| 50 |
+
const mbtiTypes = ["INTJ", "ENFP", "INFJ", "ENTP", "ISTJ"];
|
| 51 |
+
const randomType = mbtiTypes[Math.floor(Math.random() * mbtiTypes.length)];
|
| 52 |
+
|
| 53 |
+
document.getElementById("mbti-type").textContent = `MBTI μ ν: ${randomType}`;
|
| 54 |
+
document.getElementById("mbti-description").textContent = "μ±κ²© μ€λͺ
μ μ¬κΈ°μ νμλ©λλ€.";
|
| 55 |
+
document.getElementById("mbti-jobs").textContent = "μΆμ² μ§μ
: κ°λ°μ, λμμ΄λ";
|
| 56 |
+
document.getElementById("mbti-tips").textContent = "μμ° κ΄λ¦¬ μλ Ή: κ³νμ μΌλ‘ ν¬μνμΈμ.";
|
| 57 |
+
document.getElementById("mbti-image").src = "https://via.placeholder.com/150";
|
| 58 |
+
}
|
| 59 |
+
|
| 60 |
+
function restartQuiz() {
|
| 61 |
+
currentQuestion = 0;
|
| 62 |
+
answers = [];
|
| 63 |
+
document.getElementById("question-container").classList.remove("hidden");
|
| 64 |
+
document.getElementById("result-container").classList.add("hidden");
|
| 65 |
+
showQuestion();
|
| 66 |
+
}
|
| 67 |
+
|
| 68 |
+
// μ΄κΈ°ν
|
| 69 |
+
showQuestion();
|