-
Notifications
You must be signed in to change notification settings - Fork 0
/
script.js
52 lines (44 loc) · 1.68 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
$(document).ready(function () {
let cellContainer = $(".input-cell-container");
for (let i = 1; i <= 100; i++) {
let answer = "";
let n = i;
while (n > 0) {
let rem = n % 26;
if (rem == 0) {
answer = "Z" + answer;
n = Math.floor(n / 26) - 1;
} else {
answer = String.fromCharCode(rem - 1 + 65) + answer;
n = Math.floor(n / 26);
}
}
// let column = $(`<div class="column-name colcod-${answer} colId-${i}" >${answer}</div>`);
// $(".column-name-container").append(column);
// let row = $(`<div class="row-name" id="rowId-${i}">${i}</div>`);
// $(".row-name-container").append(row);
// }
// for (let i = 1; i <= 100; i++) {
// let row = $(`<div class="cell-row"></div>`);
// for (let j = 1; j <= 100; j++) {
// let colCode = $(`.colId-${j}`).attr("id").split("-")[1];
// let column = $(`<div class="input-cell" contenteditable="false" id = "row-${i}-col-${j}" data="code-${colCode}"></div>`);
// row.append(column);
// }
// $(".input-cell-container").append(row);
// }
let column = $(`<div class="column-name colId-${i}" id="colCod-${answer}">${answer}</div>`);
$(".column-name-container").append(column);
let row = $(`<div class="row-name" id="rowId-${i}">${i}</div>`);
$(".row-name-container").append(row);
}
for (let i = 1; i <= 100; i++) {
let row = $(`<div class="cell-row"></div>`);
for (let j = 1; j <= 100; j++) {
let colCode = $(`.colId-${j}`).attr("id").split("-")[1];
let column = $(`<div class="input-cell" contenteditable="true" id = "row-${i}-col-${j}" data="code-${colCode}"></div>`);
row.append(column);
}
$(".input-cell-container").append(row);
}
});