-
Notifications
You must be signed in to change notification settings - Fork 0
/
script.js
110 lines (81 loc) · 2.06 KB
/
script.js
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
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
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
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
let column = 1;
function addRow () {
let table = document.getElementById ("table");
let row = document.createElement ("tr");
table.appendChild (row);
for (let i = 0; i < column; i++) {
let cell = document.createElement ("td");
row.append (cell);
cell.textContent = "Hello";
}
}
function addColumn () {
let table = document.getElementById ("table");
let colrow = Array.from (table.children);
for (let i = 0; i < colrow.length; i++) {
let cell = document.createElement ("td");
colrow[i].append (cell);
cell.textContent = "Hello";
}
column +=1;
}
function deleteRow () {
let table = document.getElementById ("table").deleteRow(0);
}
//var firstRow = document.getElementById("myTable").rows[0];
//firstRow.deleteCell(0);
function deleteColumn () {
let table = document.getElementById ("table");
let rows = Array.from (table.children);
for (let i = 0; i < rows.length; i++) {
let delrow = document.getElementById ("table").rows[i];
delrow.deleteCell(0);
}
column -=1;
}
/****
Select color from dropdown
****/
/****
Fill all uncolored cells with
the currented selected color
****/
fillAllUncolored(){
return;
}
/****
Fill all colored cells with
the currently selected color
****/
fillAllColored(){
return;
}
/****
Clear all cells and restores their initial color
****/
restoreCells(){
return;
}
/****
Click and hold from a single cell,
to a different cell that affects
all cells hovered from start to end
to the selected color
****/
//eventListener
/*let newRow = document.createElement("row");
let a = newRow.insertCell (0);
let b = newRow.insertCell (1);
a.innerHTML = "new row, 0";
b.innerHTML = "new row, 1";
(document.querySelector("tr")).appendChild(newRow);
function insert_Row()
{
var x=document.getElementById('sampleTable').insertRow(0);
var y = x.insertCell(0);
var z = x.insertCell(1);
y.innerHTML="New Cell1";
z.innerHTML="New Cell2";
}
*/
//node.appendChild(newNode);