-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.php
563 lines (492 loc) · 25.4 KB
/
index.php
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
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Document</title>
<style>
* {
box-sizing: border-box;
}
body {
display: grid;
min-height: 100vh;
place-content: center;
}
.board {
border: 2px solid #344b61;
display: grid;
grid-template-columns: repeat(9, 60px);
grid-template-rows: repeat(9, 60px);
}
.cell input:hover {
background-color: rgb(173, 240, 173);
}
.cell input:focus-within {
background-color: rgb(136, 211, 255);
}
.cell input {
height: 100%;
width: 100%;
outline: none;
font-size: 25px;
line-height: 30px;
padding: 5px;
text-align: center;
border: none;
font-family: Source Sans Pro, sans-serif;
}
.validate {
padding: 5px;
margin: 5px;
font-size: 20px;
}
.cell-error {
background-color: rgb(233, 147, 147);
}
.highlighter {
background-color: rgb(64, 64, 209);
}
</style>
</head>
<body>
<h1 style="text-align: center; font-size: 50px;">Suduko</h1>
<table style=" margin: 10px;">
<tr>
<td><button style="font-size: 20px;" class="easy" id="easy">Easy</button></td>
<td><button style="font-size: 20px;" class="medium" id="medium">Medium</button></td>
<td><button style="font-size: 20px;" class="hard" id="hard">Hard</button></td>
</tr>
</table>
<div class="board">
<div class="cell a1" style="border-right: 1px solid #bec6d4; border-bottom: 1px solid #bec6d4; " id="cell-1">
<input maxlength="1" type="text"></div>
<div class="cell a2" style="border-right: 1px solid #bec6d4; border-bottom: 1px solid #bec6d4;" id="cell-2">
<input maxlength="1" type="text"></div>
<div class="cell a3" style="border-right: 2px solid black; border-bottom: 1px solid #bec6d4;" id="cell-3">
<input maxlength="1" type="text">
</div>
<div class="cell b1" style="border-right: 1px solid #bec6d4; border-bottom: 1px solid #bec6d4;" id="cell-4">
<input maxlength="1" maxlength="1" type="text"></div>
<div class="cell b2" style="border-right: 1px solid #bec6d4; border-bottom: 1px solid #bec6d4;" id="cell-5">
<input maxlength="1" type="text"></div>
<div class="cell b3" style="border-right: 2px solid black; border-bottom: 1px solid #bec6d4; " id="cell-6">
<input maxlength="1" type="text">
</div>
<div class="cell c1" style="border-right: 1px solid #bec6d4; border-bottom: 1px solid #bec6d4;" id="cell-7">
<input maxlength="1" type="text"></div>
<div class="cell c2" style="border-right: 1px solid #bec6d4; border-bottom: 1px solid #bec6d4;" id="cell-8">
<input maxlength="1" type="text"></div>
<div class="cell c3" style="border-bottom: 1px solid #bec6d4;" id="cell-9"><input maxlength="1" type="text">
</div>
<div class="cell a4" style="border-right: 1px solid #bec6d4; border-bottom: 1px solid #bec6d4;" id="cell-10">
<input maxlength="1" type="text"></div>
<div class="cell a5" style="border-right: 1px solid #bec6d4; border-bottom: 1px solid #bec6d4;" id="cell-11">
<input maxlength="1" type="text"></div>
<div class="cell a6" style="border-right: 2px solid black; border-bottom: 1px solid #bec6d4;" id="cell-12">
<input maxlength="1" type="text">
</div>
<div class="cell b4" style="border-right: 1px solid #bec6d4; border-bottom: 1px solid #bec6d4;" id="cell-13">
<input maxlength="1" type="text"></div>
<div class="cell b5" style="border-right: 1px solid #bec6d4; border-bottom: 1px solid #bec6d4;" id="cell-14">
<input maxlength="1" type="text"></div>
<div class="cell b6" style="border-right: 2px solid black; border-bottom: 1px solid #bec6d4;" id="cell-15">
<input maxlength="1" type="text">
</div>
<div class="cell c4" style="border-right: 1px solid #bec6d4; border-bottom: 1px solid #bec6d4;" id="cell-16">
<input maxlength="1" type="text"></div>
<div class="cell c5" style="border-right: 1px solid #bec6d4; border-bottom: 1px solid #bec6d4;" id="cell-17">
<input maxlength="1" type="text"></div>
<div class="cell c6" style="border-bottom: 1px solid #bec6d4;" id="cell-18"><input maxlength="1" type="text">
</div>
<div class="cell a7" style="border-right: 1px solid #bec6d4; border-bottom: 2px solid black;" id="cell-19">
<input maxlength="1" type="text">
</div>
<div class="cell a8" style="border-right: 1px solid #bec6d4; border-bottom: 2px solid black;" id="cell-20">
<input maxlength="1" type="text">
</div>
<div class="cell a9" style="border-right: 2px solid black; border-bottom: 2px solid black;" id="cell-21">
<input maxlength="1" type="text">
</div>
<div class="cell b7" style="border-right: 1px solid #bec6d4; border-bottom: 2px solid black;" id="cell-22">
<input maxlength="1" type="text">
</div>
<div class="cell b8" style="border-right: 1px solid #bec6d4; border-bottom: 2px solid black;" id="cell-23">
<input maxlength="1" type="text">
</div>
<div class="cell b9" style="border-right: 2px solid black; border-bottom: 2px solid black;" id="cell-24">
<input maxlength="1" type="text">
</div>
<div class="cell c7" style="border-right: 1px solid #bec6d4; border-bottom: 2px solid black;" id="cell-25">
<input maxlength="1" type="text">
</div>
<div class="cell c8" style="border-right: 1px solid #bec6d4; border-bottom: 2px solid black;" id="cell-26">
<input maxlength="1" type="text">
</div>
<div class="cell c9" style="border-bottom: 2px solid black;" id="cell-27"><input maxlength="1" type="text">
</div>
<div class="cell d1" style="border-right: 1px solid #bec6d4; border-bottom: 1px solid #bec6d4;" id="cell-28">
<input maxlength="1" type="text"></div>
<div class="cell d2" style="border-right: 1px solid #bec6d4; border-bottom: 1px solid #bec6d4;" id="cell-29">
<input maxlength="1" type="text"></div>
<div class="cell d3" style="border-right: 2px solid black; border-bottom: 1px solid #bec6d4;" id="cell-30">
<input maxlength="1" type="text">
</div>
<div class="cell e1" style="border-right: 1px solid #bec6d4; border-bottom: 1px solid #bec6d4;" id="cell-31">
<input maxlength="1" type="text"></div>
<div class="cell e2" style="border-right: 1px solid #bec6d4; border-bottom: 1px solid #bec6d4;" id="cell-32">
<input maxlength="1" type="text"></div>
<div class="cell e3" style="border-right: 2px solid black; border-bottom: 1px solid #bec6d4;" id="cell-33">
<input maxlength="1" type="text">
</div>
<div class="cell f1" style="border-right: 1px solid #bec6d4; border-bottom: 1px solid #bec6d4;" id="cell-34">
<input maxlength="1" type="text"></div>
<div class="cell f2" style="border-right: 1px solid #bec6d4; border-bottom: 1px solid #bec6d4;" id="cell-35">
<input maxlength="1" type="text"></div>
<div class="cell f3" style="border-bottom: 1px solid #bec6d4;" id="cell-36"><input maxlength="1" type="text">
</div>
<div class="cell d4" style="border-right: 1px solid #bec6d4; border-bottom: 1px solid #bec6d4;" id="cell-37">
<input maxlength="1" type="text"></div>
<div class="cell d5" style="border-right: 1px solid #bec6d4; border-bottom: 1px solid #bec6d4;" id="cell-38">
<input maxlength="1" type="text"></div>
<div class="cell d6" style="border-right: 2px solid black; border-bottom: 1px solid #bec6d4;" id="cell-39">
<input maxlength="1" type="text">
</div>
<div class="cell e4" style="border-right: 1px solid #bec6d4; border-bottom: 1px solid #bec6d4;" id="cell-40">
<input maxlength="1" type="text"></div>
<div class="cell e5" style="border-right: 1px solid #bec6d4; border-bottom: 1px solid #bec6d4;" id="cell-41">
<input maxlength="1" type="text"></div>
<div class="cell e6" style="border-right: 2px solid black; border-bottom: 1px solid #bec6d4;" id="cell-42">
<input maxlength="1" type="text">
</div>
<div class="cell f4" style="border-right: 1px solid #bec6d4; border-bottom: 1px solid #bec6d4;" id="cell-43">
<input maxlength="1" type="text"></div>
<div class="cell f5" style="border-right: 1px solid #bec6d4; border-bottom: 1px solid #bec6d4;" id="cell-44">
<input maxlength="1" type="text"></div>
<div class="cell f6" style="border-bottom: 1px solid #bec6d4;" id="cell-45"><input maxlength="1" type="text">
</div>
<div class="cell d7" style="border-right: 1px solid #bec6d4; border-bottom: 2px solid black;" id="cell-46">
<input maxlength="1" type="text">
</div>
<div class="cell d8" style="border-right: 1px solid #bec6d4; border-bottom: 2px solid black;" id="cell-47">
<input maxlength="1" type="text">
</div>
<div class="cell d9" style="border-right: 2px solid black; border-bottom: 2px solid black;" id="cell-48">
<input maxlength="1" type="text">
</div>
<div class="cell e7" style="border-right: 1px solid #bec6d4; border-bottom: 2px solid black;" id="cell-49">
<input maxlength="1" type="text">
</div>
<div class="cell e8" style="border-right: 1px solid #bec6d4; border-bottom: 2px solid black;" id="cell-50">
<input maxlength="1" type="text">
</div>
<div class="cell e9" style="border-right: 2px solid black; border-bottom: 2px solid black;" id="cell-51">
<input maxlength="1" type="text">
</div>
<div class="cell f7" style="border-right: 1px solid #bec6d4; border-bottom: 2px solid black;" id="cell-52">
<input maxlength="1" type="text">
</div>
<div class="cell f8" style="border-right: 1px solid #bec6d4; border-bottom: 2px solid black;" id="cell-53">
<input maxlength="1" type="text">
</div>
<div class="cell f9" style="border-bottom: 2px solid black;" id="cell-54"><input maxlength="1" type="text">
</div>
<div class="cell g1" style="border-right: 1px solid #bec6d4; border-bottom: 1px solid #bec6d4;" id="cell-55">
<input maxlength="1" type="text"></div>
<div class="cell g2" style="border-right: 1px solid #bec6d4; border-bottom: 1px solid #bec6d4;" id="cell-56">
<input maxlength="1" type="text"></div>
<div class="cell g3" style="border-right: 2px solid black; border-bottom: 1px solid #bec6d4;" id="cell-57">
<input maxlength="1" type="text">
</div>
<div class="cell h1" style="border-right: 1px solid #bec6d4; border-bottom: 1px solid #bec6d4;" id="cell-58">
<input maxlength="1" type="text"></div>
<div class="cell h2" style="border-right: 1px solid #bec6d4; border-bottom: 1px solid #bec6d4;" id="cell-59">
<input maxlength="1" type="text"></div>
<div class="cell h3" style="border-right: 2px solid black; border-bottom: 1px solid #bec6d4;" id="cell-60">
<input maxlength="1" type="text">
</div>
<div class="cell i1" style="border-right: 1px solid #bec6d4; border-bottom: 1px solid #bec6d4;" id="cell-61">
<input maxlength="1" type="text"></div>
<div class="cell i2" style="border-right: 1px solid #bec6d4; border-bottom: 1px solid #bec6d4;" id="cell-62">
<input maxlength="1" type="text"></div>
<div class="cell i3" style="border-bottom: 1px solid #bec6d4;" id="cell-63"><input maxlength="1" type="text">
</div>
<div class="cell g4" style="border-right: 1px solid #bec6d4; border-bottom: 1px solid #bec6d4;" id="cell-64">
<input maxlength="1" type="text"></div>
<div class="cell g5" style="border-right: 1px solid #bec6d4; border-bottom: 1px solid #bec6d4;" id="cell-65">
<input maxlength="1" type="text"></div>
<div class="cell g6" style="border-right: 2px solid black; border-bottom: 1px solid #bec6d4;" id="cell-66">
<input maxlength="1" type="text">
</div>
<div class="cell h4" style="border-right: 1px solid #bec6d4; border-bottom: 1px solid #bec6d4;" id="cell-67">
<input maxlength="1" type="text"></div>
<div class="cell h5" style="border-right: 1px solid #bec6d4; border-bottom: 1px solid #bec6d4;" id="cell-68">
<input maxlength="1" type="text"></div>
<div class="cell h6" style="border-right: 2px solid black; border-bottom: 1px solid #bec6d4;" id="cell-69">
<input maxlength="1" type="text">
</div>
<div class="cell i4" style="border-right: 1px solid #bec6d4; border-bottom: 1px solid #bec6d4;" id="cell-70">
<input maxlength="1" type="text"></div>
<div class="cell i5" style="border-right: 1px solid #bec6d4; border-bottom: 1px solid #bec6d4;" id="cell-71">
<input maxlength="1" type="text"></div>
<div class="cell i6" style="border-bottom: 1px solid #bec6d4;" id="cell-72"><input maxlength="1" type="text">
</div>
<div class="cell g7" style="border-right: 1px solid #bec6d4;" id="cell-73"><input maxlength="1" type="text">
</div>
<div class="cell g8" style="border-right: 1px solid #bec6d4;" id="cell-74"><input maxlength="1" type="text">
</div>
<div class="cell g9" style="border-right: 2px solid black;" id="cell-75"><input maxlength="1" type="text"></div>
<div class="cell h7" style="border-right: 1px solid #bec6d4;" id="cell-76"><input maxlength="1" type="text">
</div>
<div class="cell h8" style="border-right: 1px solid #bec6d4;" id="cell-77"><input maxlength="1" type="text">
</div>
<div class="cell h9" style="border-right: 2px solid black;" id="cell-78"><input maxlength="1" type="text"></div>
<div class="cell i7" style="border-right: 1px solid #bec6d4;" id="cell-79"><input maxlength="1" type="text">
</div>
<div class="cell i8" style="border-right: 1px solid #bec6d4;" id="cell-80"><input maxlength="1" type="text">
</div>
<div class="cell i9" id="cell-81"><input maxlength="1" type="text"></div>
</div>
<button class="validate" id="validate">validate</button>
<script>
//validation of single row
function validaterow(rownumber) {
const start = (rownumber - 1) * 9 + 1
const end = rownumber * 9
var error = false
// Adding error class to duplicates
for (let i = start; i <= end; i++) {
document.querySelector(`#cell-${i} input`).classList.remove("cell-error")
if (document.querySelector(`#cell-${i} input`).disabled != true) {
const p = document.querySelector(`#cell-${i} input`).value
for (let j = start; j <= end; j++) {
if (j != i) {
const u = document.querySelector(`#cell-${j} input`).value
if (p == u && p != "" && u != "") {
document.querySelector(`#cell-${i} input`).classList.add("cell-error")
error = true
return error
}
}
}
}
}
}
//validation of all rows
function validaterows() {
for (let i = 1; i <= 9; i++) {
var error = validaterow(i)
if (error) {
return false;
}
}
return true
}
//validation of single column
function validatecolumn(columnnumber) {
const start = columnnumber
const end = 72 + columnnumber
var error = false
// Adding error class to duplicates
for (let i = start; i <= end; i = i + 9) {
if (document.querySelector(`#cell-${i} input`).disabled != true) {
const p = document.querySelector(`#cell-${i} input`).value
for (let j = start; j <= end; j = j + 9) {
if (j != i) {
const u = document.querySelector(`#cell-${j} input`).value
if (p == u && p != "" && u != "") {
document.querySelector(`#cell-${i} input`).classList.add("cell-error")
error = true
return error
}
}
}
}
}
}
//validation of all columns
function validatecolumns() {
for (let i = 1; i <= 9; i++) {
var error = validatecolumn(i)
if (error) {
return false
}
}
return true
}
// validation of all blocks
function validateblock(blockno) {
var error = false
for (let i = 1; i <= 9; i++) {
var blockid1 = ""
blockid1 += blockno
blockid1 += i
const p = document.querySelector(`.${blockid1} input`).value
if (document.querySelector(`.${blockid1} input`).disabled != true) {
for (let j = 1; j <= 9; j++) {
var blockid2 = ""
blockid2 += blockno
blockid2 += j
const u = document.querySelector(`.${blockid2} input`).value
if (j != i) {
if (p == u && p != "" && u != "") {
document.querySelector(`.${blockid1} input`).classList.add("cell-error")
error = true
return error
}
}
}
}
}
}
function validateblocks() {
const ab = ["a", "b", "c", "d", "e", "f", "g", "h", "i"]
for (let i = 0; i < 9; i++) {
var error = validateblock(ab[i])
if(error){
return false
break;
}
}
return true
}
//setting up initial board for difficulty level easy
function setupeasyboard() {
const board = [
[0, 0, 0, 2, 6, 0, 7, 0, 1],
[6, 8, 0, 0, 7, 0, 0, 9, 0],
[1, 9, 0, 0, 0, 4, 5, 0, 0],
[8, 2, 0, 1, 0, 0, 0, 4, 0],
[0, 0, 4, 6, 0, 2, 9, 0, 0],
[0, 5, 0, 0, 0, 3, 0, 2, 8],
[0, 0, 9, 3, 0, 0, 0, 7, 4],
[0, 4, 0, 0, 5, 0, 0, 3, 6],
[7, 0, 3, 0, 1, 8, 0, 0, 0],
]
board.forEach((row, rowidx) => {
row.forEach((col, colidx) => {
const cellidx = rowidx * 9 + colidx + 1
if (board[rowidx][colidx] == 0) {
document.querySelector(`#cell-${cellidx} input`).disabled = false;
document.querySelector(`#cell-${cellidx} input`).classList.remove("cell-error")
document.querySelector(`#cell-${cellidx} input`).value = ""
} else {
document.querySelector(`#cell-${cellidx} input`).classList.remove("cell-error")
document.querySelector(`#cell-${cellidx} input`).value = board[rowidx][colidx]
document.querySelector(`#cell-${cellidx} input`).disabled = true;
}
})
})
}
document.getElementById("easy").addEventListener("click", setupeasyboard)
//setting up initial board for difficulty level medium
function setupmediumboard() {
const board = [
[0, 0, 0, 6, 0, 0, 0, 0, 7],
[0, 7, 8, 0, 0, 0, 0, 0, 5],
[2, 0, 5, 0, 0, 0, 6, 0, 0],
[0, 0, 2, 0, 0, 1, 3, 4, 0],
[0, 0, 0, 2, 0, 0, 0, 0, 1],
[8, 0, 0, 7, 4, 0, 0, 5, 6],
[0, 9, 0, 8, 6, 0, 1, 3, 0],
[1, 0, 6, 0, 7, 0, 5, 0, 8],
[0, 0, 0, 0, 0, 9, 0, 0, 0],
]
board.forEach((row, rowidx) => {
row.forEach((col, colidx) => {
const cellidx = rowidx * 9 + colidx + 1
if (board[rowidx][colidx] == 0) {
document.querySelector(`#cell-${cellidx} input`).disabled = false;
document.querySelector(`#cell-${cellidx} input`).classList.remove("cell-error")
document.querySelector(`#cell-${cellidx} input`).value = ""
} else {
document.querySelector(`#cell-${cellidx} input`).classList.remove("cell-error")
document.querySelector(`#cell-${cellidx} input`).value = board[rowidx][colidx]
document.querySelector(`#cell-${cellidx} input`).disabled = true;
}
})
})
}
document.getElementById("medium").addEventListener("click", setupmediumboard)
//setting up initial board for difficulty level hard
function setuphardboard() {
const board = [
[0, 0, 0, 0, 0, 3, 0, 8, 0],
[0, 9, 0, 0, 0, 7, 0, 5, 0],
[5, 8, 0, 0, 2, 0, 0, 6, 0],
[0, 1, 0, 6, 0, 0, 0, 9, 0],
[0, 0, 0, 0, 0, 0, 0, 0, 0],
[0, 5, 0, 0, 0, 2, 7, 0, 0],
[0, 0, 1, 0, 3, 0, 9, 0, 0],
[0, 2, 0, 0, 0, 1, 4, 0, 0],
[3, 0, 8, 0, 0, 0, 0, 0, 0],
]
board.forEach((row, rowidx) => {
row.forEach((col, colidx) => {
const cellidx = rowidx * 9 + colidx + 1
if (board[rowidx][colidx] == 0) {
document.querySelector(`#cell-${cellidx} input`).disabled = false;
document.querySelector(`#cell-${cellidx} input`).classList.remove("cell-error")
document.querySelector(`#cell-${cellidx} input`).value = ""
} else {
document.querySelector(`#cell-${cellidx} input`).classList.remove("cell-error")
document.querySelector(`#cell-${cellidx} input`).value = board[rowidx][colidx]
document.querySelector(`#cell-${cellidx} input`).disabled = true;
}
})
})
}
document.getElementById("hard").addEventListener("click", setuphardboard)
//validation of full suduko
function validatesuduko() {
var x = validaterows()
var y = validatecolumns()
var z = validateblocks()
var winner = true
for (let i = 1; i <= 81; i++) {
var valuec = document.querySelector(`#cell-${i} input`).value
if (valuec == "") {
winner = false
}
}
if (winner) {
if (x && y && z) {
alert(" Congratulations, You won the game !!")
console.log(" Congratulations, You won the game !!")
} else {
console.log("1")
alert("oops you are going wrong!")
console.log("oops you are going wrong!")
}
} else {
if (x && y && z) {
alert("You are going right, Dont stop!")
console.log("You are going right, Dont stop!")
} else {
alert("oops you are going wrong!")
console.log("2")
console.log("oops you are going wrong!")
}
}
}
//activate validation on click of button(validate)
document.getElementById('validate').addEventListener('click', validatesuduko)
//input no from 0 to 9
var ipboxs = document.querySelectorAll('.cell input');
for (let i = 0; i < ipboxs.length; i++) {
ipboxs[i].addEventListener('keyup', function (event) {
// console.log(ipboxs[i].value)
var regExp = /[a-zA-Z]/g;
var testString = ipboxs[i].value;
if (regExp.test(testString)) {
ipboxs[i].value = "";
// alert("cant enter alphabets")
} else {
}
});
}
setupeasyboard()
</script>
</body>
</html>