37 lines
980 B
JavaScript
37 lines
980 B
JavaScript
let buttonW = document.getElementById("buttonW");
|
|
let wordInput = document.getElementById("word");
|
|
let wordInput2 = document.getElementById("word2");
|
|
let typeE = document.getElementById("selType");
|
|
let opE = document.getElementById("selOp");
|
|
let resultInput = document.getElementById("res");
|
|
function aba(cmd,type,wd,wd2){
|
|
fetch(`http://192.168.56.101:8080/${cmd}${type}?x=${wd}&y=${wd2}`)
|
|
.then(response => response.text())
|
|
.then(res => resultInput.value = res);
|
|
}
|
|
buttonW.onclick = function(event) {
|
|
let wd = wordInput.value;
|
|
let wd2 = wordInput2.value;
|
|
let type = typeE.options[typeE.selectedIndex].text;
|
|
let oper = opE.options[opE.selectedIndex].text;
|
|
switch(oper)
|
|
{
|
|
case "+":
|
|
aba('sum',type,wd,wd2)
|
|
break;
|
|
case "-":
|
|
aba('min',type,wd,wd2)
|
|
break;
|
|
case "=":
|
|
aba('com',type,wd,wd2)
|
|
break;
|
|
case "><":
|
|
aba('rev',type,wd,wd2)
|
|
break;
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|