HTML事件屬性O(shè)nmousemove
HTML事件屬性O(shè)nmousemove
觸發(fā)onmousemove
屬性事件當(dāng)鼠標(biāo)指針在一個(gè)元素上移動時(shí)。
HTML5中的新功能
沒有。
句法
<element onmousemove="script or Javascript function name">
支持的標(biāo)簽
所有HTML元素,EXCEPT:
<base>, <bdo>, <br>, <head>, <html>, <iframe>, <meta>, <param>, <script>, <style>, <title>
瀏覽器兼容性
| Yes | Yes | Yes | Yes | Yes |
例子
<!DOCTYPE html>
<html>
<body>
<p id="p1" onmousemove="onmouseMove()" onmouseup="mouseUp()">
Click the text!
</p>
<script>
function onmouseMove() {
console.log("move");
}
function mouseUp() {
console.log("up");
}
</script>
</body>
</html>
Click to view the demo