<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Title</title>
</head>
<body>
<button id="idBtn">open</button>
<div id="idDiv" style="width: 200px;height: 200px;background: #00f" hidden="true">ТУТА мИнЮ</div>
<script>
let div=document.getElementById('idDiv');
let btn=document.getElementById('idBtn');
btn.onmousedown=()=>do1();
function do1() {
div.hidden=false;
btn.innerText='Close'
btn.onmousedown=()=>do2();
}
function do2() {
btn.onmousedown=()=>do1();
btn.innerText='Open';
div.hidden=true
}
</script>
</body>
</html>
var duration = 100;
var time = 5
var progressBar = time * 1000;
var count = duration * time;
var counter = setInterval(timer, 10);
function timer(cou) {
cou= cou - 1;
if (cou< 0) {
clearInterval(counter);
SpinRoulette()
return count
}
const countdown = (count / duration);
document.getElementById('countdown').innerHTML = countdown;
const progressElement = document.getElementById('progress-countdown')
progressBar -= 10;
const currentProgressBarValue = progressBar / 1000;
progressElement.value = currentProgressBarValue
}
timer(count)
<body>
<input id="inp" width="11em" style='border-bottom-color: black'>
<script>
let inp=document.getElementById('inp');
inp.oninput=()=>{
let rText='';
let s=inp.value.replace(/\s+/g, '');
s.split('').forEach((it,i)=>{
if (i%3===0){
rText+=' ';
}
rText+=it;
});
inp.value=rText;
}
</script>
</body>
<body>
<button name="bt" value="1">1</button>
<button name="bt" value="2">2</button>
<button name="bt" value="3">3</button>
<script>
let sum=0;
let s=document.getElementsByName('bt');
s.forEach(item=>item.onmousedown=()=>btclick(item))
let btclick=(bt)=>{
sum=sum+parseInt(bt.value)
console.log(bt.value+' pressedDown'+' sum='+sum);
bt.style.background='green'
bt.onmousedown=()=>btUnClick(bt)
testAllBtIsPress(sum)
}
let btUnClick=(bt)=>{
bt.style.background='grey';
bt.onmousedown=()=>btclick(bt);
sum=sum-parseInt(bt.value)
console.log(bt.value+' pressedUP'+'sum='+sum);
}
let testAllBtIsPress=(a)=>{
if (a===6){alert('ТАДАМ!! AllButtonsPressed')}
}
</script>
</body>