-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbaseDataStructure.js
More file actions
48 lines (32 loc) · 1.24 KB
/
baseDataStructure.js
File metadata and controls
48 lines (32 loc) · 1.24 KB
1
2
3
4
5
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
import { Length, boardExist } from "./Stack";
function clearAll() {
removeInput();
}
function removeInput() {
console.log('removeInput function is activated.');
let board = document.getElementById('input');
boardExist = false;
board.innerHTML = '';
board.setAttribute('background-color', 'transparent');
}
function assign() { //出現輸入列 然後交給build
console.log('assign()');
if (!boardExist) {
boardExist = true;
let inputBoard = document.createElement('input');
let inputBoardContainer = document.getElementById('input');
let submit = document.createElement('button');
let cancel = document.createElement('button')
inputBoardContainer.setAttribute('background-color', 'white');
inputBoardContainer.className = 'input';
inputBoard.type = Number;
inputBoard.id = 'inputBoard';
inputBoard.placeholder = '請輸入0~10之間的數字';
submit.value = 'submit';
submit.addEventListener('click', build, false);
cancel.value = 'cancel';
cancel.addEventListener('click', removeInput, false);
inputBoardContainer.appendChild(inputBoard);
inputBoardContainer.appendChild(submit);
}
}