Files
webServerTest/main.js
2025-08-21 20:29:06 +02:00

39 lines
753 B
JavaScript

async function press() {
const res = await fetch('/press', {
method: 'POST'
});
const data = await res.text();
alert(data);
}
let isRed = false;
function redBg() {
if (isRed === false) {
document.body.style.background = 'red';
isRed = true;
}else {
document.body.style.background = '';
isRed = false;
}
}
const addButton = document.getElementById('addButton');
addButton.addEventListener('click', handleInput);
let i = 0;
function handleInput() {
const inputText = document.getElementById('inputText').value;
/*alert(inputText);*/
const table = document.getElementById('contentTable');
const newRow = table.insertRow();
i++;
newRow.insertCell(0).textContent = i;
newRow.insertCell(1).textContent = inputText;
};