diff --git a/1/chess.js b/1/chess.js new file mode 100644 index 0000000..7a6b492 --- /dev/null +++ b/1/chess.js @@ -0,0 +1,20 @@ +function drawBoard() { + let board = document.querySelector('.board') + let block + let flag = true + for (let i = 0; i < 8; i++) { + for (let j = 0; j < 8; j++) { + if (j == 0) flag = !flag; + block = document.createElement('div') + if (flag) { + block.classList = 'block black' + } else { + block.classList = 'block white' + } + board.appendChild(block); + flag = !flag; + } + } +} + +drawBoard() \ No newline at end of file diff --git a/1/index.html b/1/index.html new file mode 100644 index 0000000..bd729f6 --- /dev/null +++ b/1/index.html @@ -0,0 +1,14 @@ + + + + + Шахматная доска + + + + +
+ + + + \ No newline at end of file diff --git a/1/style.css b/1/style.css new file mode 100644 index 0000000..852622f --- /dev/null +++ b/1/style.css @@ -0,0 +1,20 @@ +.board { + height: 640px; + width: 640px; + margin: 30px auto; + border: 1px solid black; +} + +.block { + height: 80px; + width: 80px; + float: left; +} + +.black { + background: black; +} + +.white { + background: white; +} \ No newline at end of file diff --git a/2/index.html b/2/index.html new file mode 100644 index 0000000..dae03cc --- /dev/null +++ b/2/index.html @@ -0,0 +1,13 @@ + + + + + Корзина + + + +
#test
+ + + + \ No newline at end of file diff --git a/2/soruse.js b/2/soruse.js new file mode 100644 index 0000000..ea26d6f --- /dev/null +++ b/2/soruse.js @@ -0,0 +1,31 @@ +var basket = { + summ: 0, + items: [], + append: function (item) { this.items.push(item) }, + get_size: function () { return this.items.length }, + get_items: function () { return this.items }, + all_cost: function () { + + for (var i in this.items) { + if (i != undefined) { this.summ += this.items[i].cost } + } + if (this.summ == 0) { + return 'корзина пуста' + } else{ + return this.summ + } + + } + +} + +// var it = { name: 'Пицца', cost: 150 } +// var it2 = { name: 'Машина', cost: 1500 } +// basket.append(it) +// basket.append(it2) + +function drawBoard() { + alert(basket.all_cost()) +} + +drawBoard() \ No newline at end of file