function loadDoc() {
function success() {
console.log(JSON.parse(xhttp.responseText));
}
var xhttp = new XMLHttpRequest();
xhttp.open("POST", "Rest.php", true);
xhttp.onreadystatechange = function() {
if (this.readyState == 4 && this.status == 200) {
return success();
}
};
xhttp.send();
}
loadDoc();
<div class="result pointer" onclick="jump(this);" style="background:#eee; display: inline-block; padding: 5px;">
Прыгучий объект
</div>
<script type="text/javascript">
function jump (el) {
el.style.position='relative';
var i=0, an= setInterval(function() {
if (i>=Math.PI) {
clearInterval(an);
el.style.top= 0;
} else el.style.top= -100*Math.sin(i) + 'px';
i+=.1;
},25)
}
</script>
<button onclick="go();">Пуск</button>
<script>
function go () {
let t= " in ax2 + bx + c",
a = prompt("Enter a value"+t, 10),
b = prompt("Enter b value"+t, 10),
c = prompt("Enter c value"+t, 10),
result;
if(a === 0 && b === 0 && c === 0){
return alert ("The values must be bigger than 0");
}
var discr = (b * b ) - 4 * a * c,
sqrtDiscr = Math.sqrt(discr);
if(discr < 0 ){
return alert ("This Equation have not solution");
}
if(discr === 0 ){
console.log("This Equation have only 1 solution")
result = (-b) / (2 * a);
} else {
console.log("This Equation have 2 solution");
result = ((- b + sqrtDiscr) / (2 * a)).toFixed(2) + "; \n" + ((- b - sqrtDiscr) / (2 * a)).toFixed(2);
alert (result);
}
}
document.querySelector('#zakaz-status').onchange= function() {
document.querySelector('#autsors-select').hidden= !(this.value === '8');
}