&nbs"/> &nbs">
onwheel 當滑鼠滾輪在元素上向上或向下捲動時觸發屬性。您可以嘗試執行以下程式碼來實作onwheel 屬性 -
<!DOCTYPE html> <html> <body> <h3 id = "myid" onwheel = "mouseWheel()"> This is demo heading. </h3> <p>Click above and use mouse wheel to change the heading color.</p> <script> function mouseWheel() { document.getElementById("myid").style.color = "red"; } </script> </body> </html>
以上是當滑鼠滾輪在HTML元素上向上或向下滾動時執行腳本?的詳細內容。更多資訊請關注PHP中文網其他相關文章!