當滑鼠按鈕在 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>
廣告
資料結構
網路
RDBMS
作業系統
Java
iOS
HTML
CSS
Android
Python
C 程式設計
C++
C#
MongoDB
MySQL
Javascript
PHP