App.js 3.17 KB
Newer Older
Yoon, Daeki's avatar
Yoon, Daeki committed
1
2
3
import React from 'react';
import logo from './logo.svg';
import './App.css';
baesangjune's avatar
d    
baesangjune committed
4
import ReactDOM from 'react-dom';
Yoon, Daeki's avatar
Yoon, Daeki committed
5

baesangjune's avatar
d    
baesangjune committed
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
let answer=[]
function App(props) {
  let correctAnswer = {"1번": 3, "2번": 4}

  return (
    <>
      <div className="App">
        <h1 style={{ background: "orange", display: "inline-block", border: "3px solid black", width: "200px" }}> Online-Quiz</h1>
      </div>
      <div className="App">
        이름을 입력하세요
        <input onChange={(event) => { console.log(event.target.value) }} />
      </div>
      <button onClick={ShowQuiz1} style={{ margin: "30px", marginLeft: "355px", width: "150px", height: "30px", fontFamily : "impact"}}>Quiz Start ! </button>
    </>
  );
}
function Next() {
  return alert("다음문제")
  //선택한 정답과 실제정답이 일치하는지 판별
}

function Quiz1() {
  return (
    <>
      <h2>Q1. 3 + 3 = ?</h2>
      <div> 2</div>
      <div> 4</div>
      <div> 6</div>
      <div> 8</div>
      <div className="App" style={{ float: "left" }}>
        정답을 입력하세요
        <select id="number1">
          <option value="0" hidden disabled selected>정답선택</option>
          <option value="1"></option>
          <option value="2"></option>
          <option value="3"></option>
          <option value="4"></option>
        </select>
        <button onClick={ShowQuiz2} style={{ marginLeft: "10px" }}>다음</button>
        <meta http-equiv="Refresh" content="3; url=here"/>
      </div>
    </>
  );
}
function ShowQuiz1() {
  ReactDOM.render(
    <React.StrictMode>
      <Quiz1 />
    </React.StrictMode>,
    document.getElementById('root')
  );
}
// function SelectAnswer(e){
//   let a = document.getElementById("number1").value
//   answer.push(a)
// }

function Quiz2() {
Yoon, Daeki's avatar
Yoon, Daeki committed
65
  return (
baesangjune's avatar
d    
baesangjune committed
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
    <>
      <h2>Q1. 6 x 4 = ?</h2>
      <div> 6</div>
      <div> 12</div>
      <div> 18</div>
      <div> 24</div>
      <div className="App" style={{ float: "left" }}>
        정답을 입력하세요
        <select>
          <option hidden disabled selected>정답선택</option>
          <option value="6"></option>
          <option value="12"></option>
          <option value="18"></option>
          <option value="24"></option>
        </select>
        <button onClick={Showlast} style={{ marginLeft: "10px" }}>다음</button>
 
        <meta http-equiv="Location" content="here" />
        <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />

        {localStorage.setItem('Answer1', 'select id')
        , localStorage.getItem('Answer1'), localStorage.removeItem, localStorage.clear}

      </div>
    </>
Yoon, Daeki's avatar
Yoon, Daeki committed
91
92
  );
}
baesangjune's avatar
d    
baesangjune committed
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
function ShowQuiz2() {
  ReactDOM.render(
    <React.StrictMode>
      <Quiz2 />
    </React.StrictMode>,
    document.getElementById('root')
  );
}

function Last() {
  return (
    <>
      <div className="App" style={{ margin: "30px", fontSize: "2.0em" }}>Quiz 완료</div>
      <h1 style={{ marginLeft: "298px" }}>수고하셨습니다 !!</h1>
    </>
  )
}
function Showlast() {
  ReactDOM.render(
    <React.StrictMode>
      <Last />
    </React.StrictMode>,
    document.getElementById('root')
  );
}

Yoon, Daeki's avatar
Yoon, Daeki committed
119
120

export default App;
baesangjune's avatar
d    
baesangjune committed
121
// export default Quiz1;