Untitled
4 days ago in JavaScript
function makeGrid(height, width) {
width = document.querySelector('#inputWidth').value;
height = document.querySelector('#inputHeight').value;

for(var i = 1; i <= height; i++) {
document.querySelector('table').appendChild('tr');}

for( i = 1; i <= width; i++) {
document.querySelector('tr').appendChild('td');

}}

//------------------------------------------------------------------

function paintCell() {
document.querySelector('td').addEventListener= ('click',function () {
var color = document.querySelector('#colorPicker').value;
document.querySelector('td').style.backgroundColor= color;} );


}


//------------------------------------------------------------------
document.querySelector('#sizePicker').addEventListener('submit', function (e){
e.preventDefault();
makeGrid();
paintCell();

});


//------------------------------------------------------------------

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