用户释放HTML键时执行脚本?
使用onkeyup属性。用户释放键时会触发onkeyup属性。
示例
您可以尝试运行以下代码以在释放键时执行脚本-
<!DOCTYPE html>
<html>
<body>
<p>Press a key inside the textbox.</p>
<input type = "text" onkeydown = "display()">
<script>
function display() {
alert("您释放了钥匙!");
}
</script>
</body>
</html>