onwheel?當(dāng)鼠標(biāo)滾輪在元素上向上或向下滾動時觸發(fā)屬性。您可以嘗試運(yùn)行以下代碼來實現(xiàn)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>
登錄后復(fù)制
以上就是當(dāng)鼠標(biāo)滾輪在HTML元素上向上或向下滾動時執(zhí)行腳本?的詳細(xì)內(nèi)容,更多請關(guān)注www.92cms.cn其它相關(guān)文章!






