<div onmousedown="down()" onmouseup="up()" onclick="cli()">长按事件</div> <progress value="0" max="100"></progress> <script> let progress = document.getElementsByTagName('progress')[0]; let time = ""; let lock = true; function down() { time = setInterval(() => { lock = false; progress.value += 5 }, 1000) } function up() { clearInterval(time); setTimeout(() => { lock = true; }) } function cli() { if (lock) { alert(progress.value); } } </script>