IP_Razzhivin_PIBD-22/frontend/script.js
Александр Разживин 7b39744930 lab 1
2023-04-18 10:21:04 +04:00

37 lines
1.0 KiB
JavaScript

let upperButton = document.getElementById("upperbutton");
let lowerButton = document.getElementById("lowerbutton");
let reverseButton = document.getElementById("reversebutton");
let shuffleButton = document.getElementById("shufflebutton");
let Input = document.getElementById("input");
let Output = document.getElementById("output");
let dop = document.getElementById("dop");
upperButton.onclick = function() {
changetext("Upper");
};
lowerButton.onclick = function() {
changetext("Lower");
};
reverseButton.onclick = function() {
changetext("Reverse");
};
shuffleButton.onclick = function() {
changetext("Shuffle");
};
dop.onclick = function() {
changetext("Dop");
};
function changetext(str) {
let address;
address = str;
executeRequest(address);
}
function executeRequest(address) {
let _input = Input.value;
console.log(_input);
fetch(`http://localhost:8080/${address}?Inputtext=${_input}`)
.then(response => response.text())
.then(res => Output.value = res);
}