background colour conditions

master
louisa 1 year ago
parent e4bbac2a88
commit 543b477cca

@ -19,23 +19,17 @@
// Split the data into separate parts // Split the data into separate parts
const [node, value] = data.split(' '); const [node, value] = data.split(' ');
if (node === 'node3' && value === '15') { if (node === 'node3' && value === '15') {
// Change the background color to red // Change the background color to red
document.body.style.backgroundColor = 'red'; document.body.style.backgroundColor = 'red';
} } else if (node === 'node4' && value === '21') {
if (node === 'node4' && value === '21') {
// Change the background color to blue // Change the background color to blue
document.body.style.backgroundColor = 'blue'; document.body.style.backgroundColor = 'blue';
} } else {
else {
// Restore the default background color // Restore the default background color
document.body.style.backgroundColor = 'white'; document.body.style.backgroundColor = rgb(26, 26, 26);
} }
}); });
function sendMessage() { function sendMessage() {
const inputField = document.getElementById('input'); const inputField = document.getElementById('input');
const message = inputField.value; const message = inputField.value;

Loading…
Cancel
Save