Программисты Html
Anonymous
Игра с низкой цветовой коробкой непрозрачно
Сообщение
Anonymous » 24 янв 2025, 09:48
Цветовая коробка с низкой непрозрачностью < /p>
Код: Выделить всё
const tableContainer = document.getElementById('table-container');
let size = 2;
function createTable(size) {
const table = document.createElement('table');
table.id = 'dynamicTable';
const backgroundColor = getRandomColor();
for (let i = 0; i < size; i++) {
const row = document.createElement('tr');
for (let j = 0; j < size; j++) {
const cell = document.createElement('td');
cell.style.backgroundColor = backgroundColor;
cell.addEventListener('click', () => handleCellClick(cell));
row.appendChild(cell);
}
table.appendChild(row);
}
return table;
}
function getRandomColor() {
const letters = '0123456789ABCDEF';
let color = '#';
for (let i = 0; i < 6; i++) {
color += letters[Math.floor(Math.random() * 16)];
}
return color;
}
function randomlyReduceOpacity(table) {
const cells = table.querySelectorAll('td');
const randomIndex = Math.floor(Math.random() * cells.length);
const randomCell = cells[randomIndex];
randomCell.style.opacity = 0.5;
randomCell.classList.add('reduced-opacity');
}
function handleCellClick(cell) {
if (cell.classList.contains('reduced-opacity') && size < 10) {
size++;
tableContainer.innerHTML = '';
const newTable = createTable(size);
tableContainer.appendChild(newTable);
randomlyReduceOpacity(newTable);
}
}
const initialTable = createTable(size);
tableContainer.appendChild(initialTable);
randomlyReduceOpacity(initialTable);
Код: Выделить всё
body {
font-family: Arial, sans-serif;
display: flex;
justify-content: center;
align-items: center;
height: 100vh;
margin: 0;
}
table {
border-collapse: collapse;
}
td {
width: 50px;
height: 50px;
text-align: center;
vertical-align: middle;
border: 1px solid #ddd;
cursor: pointer;
}< /code>
Подробнее здесь:
https://stackoverflow.com/questions/793 ... r-box-game
1737701303
Anonymous
Цветовая коробка с низкой непрозрачностью < /p> [code]const tableContainer = document.getElementById('table-container'); let size = 2; function createTable(size) { const table = document.createElement('table'); table.id = 'dynamicTable'; const backgroundColor = getRandomColor(); for (let i = 0; i < size; i++) { const row = document.createElement('tr'); for (let j = 0; j < size; j++) { const cell = document.createElement('td'); cell.style.backgroundColor = backgroundColor; cell.addEventListener('click', () => handleCellClick(cell)); row.appendChild(cell); } table.appendChild(row); } return table; } function getRandomColor() { const letters = '0123456789ABCDEF'; let color = '#'; for (let i = 0; i < 6; i++) { color += letters[Math.floor(Math.random() * 16)]; } return color; } function randomlyReduceOpacity(table) { const cells = table.querySelectorAll('td'); const randomIndex = Math.floor(Math.random() * cells.length); const randomCell = cells[randomIndex]; randomCell.style.opacity = 0.5; randomCell.classList.add('reduced-opacity'); } function handleCellClick(cell) { if (cell.classList.contains('reduced-opacity') && size < 10) { size++; tableContainer.innerHTML = ''; const newTable = createTable(size); tableContainer.appendChild(newTable); randomlyReduceOpacity(newTable); } } const initialTable = createTable(size); tableContainer.appendChild(initialTable); randomlyReduceOpacity(initialTable);[/code] [code]body { font-family: Arial, sans-serif; display: flex; justify-content: center; align-items: center; height: 100vh; margin: 0; } table { border-collapse: collapse; } td { width: 50px; height: 50px; text-align: center; vertical-align: middle; border: 1px solid #ddd; cursor: pointer; }< /code> [/code] Подробнее здесь: [url]https://stackoverflow.com/questions/79383319/low-opacity-color-box-game[/url]
Игра с низкой цветовой коробкой непрозрачно
Anonymous »
24 янв 2025, 08:33 » в форуме
Html
Цветовая коробка с низкой непрозрачностью
Dynamic Table
body {
font-family: Arial, sans-serif;
display: flex;
justify-content: center;
align-items: center;
height: 100vh;
margin: 0;
}
table {
border-collapse: collapse;
}
td {...
0 Ответы
13 Просмотры
Последнее сообщение Anonymous
24 янв 2025, 08:33
Игра с цветными коробками с низкой непрозрачностью
Anonymous »
24 янв 2025, 08:33 » в форуме
Javascript
Цветное поле с низкой непрозрачностью
Dynamic Table
body {
font-family: Arial, sans-serif;
display: flex;
justify-content: center;
align-items: center;
height: 100vh;
margin: 0;
}
table {
border-collapse: collapse;
}
td {
width:...
0 Ответы
8 Просмотры
Последнее сообщение Anonymous
24 янв 2025, 08:33
0 Ответы
54 Просмотры
Последнее сообщение Гость
24 сен 2023, 04:50
0 Ответы
56 Просмотры
Последнее сообщение Гость
24 сен 2023, 11:37
0 Ответы
14 Просмотры
Последнее сообщение Anonymous
09 апр 2025, 14:10