在HTML元素上释放鼠标按钮时执行脚本?
在元素上释放鼠标按钮时,将触发onmouseup 事件。您可以尝试运行以下代码以实现onmouseup 属性-
示例
<!DOCTYPE html><html>
<body>
<h3 id = "myid" onmousedown = "mouseDown()" onmouseup = "mouseUp()">
This is demo heading.
</h3>
<p>Click above and then release.</p>
<script>
function mouseDown() {
document.getElementById("myid").style.color = "yellow";
}
function mouseUp() {
document.getElementById("myid").style.color = "blue";
}
</script>
</body>
</html>
以上是 在HTML元素上释放鼠标按钮时执行脚本? 的全部内容, 来源链接: utcz.com/z/334907.html