onmousemoveイベント


onmousemoveイベント

インスタンス

<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8"> 
<script>
function bigImg(x){
	x.style.height="64px";
	x.style.width="64px";
}
function normalImg(x){
	x.style.height="32px";
	x.style.width="32px";
}
</script>
</head>
<body>

<img onmousemove="bigImg(this)" onmouseout="normalImg(this)" border="0" src="smiley.gif" alt="Smiley" width="32" height="32">
<p>函数 bigImg() 在鼠标指针移动到笑脸图片是触发。</p>
<p>函数 normalImg() 在鼠标指针移出笑脸图片是触发。</p>

</body>
</html>

インスタンスを実行する»

オンラインインスタンスを表示するには、「インスタンスを実行」ボタンをクリックしてください


定義と使用法

マウスの場合に発生しますポインタがオブジェクトの外に移動するという現象が発生します。

構文

HTML の場合:

<elementonmousemove="SomeJavaScriptCode">

JavaScript の場合:

object.onmousemove=function(){ Java Scriptコード};

パラメータ説明
SomeJavaScriptCode必須。このイベントが発生したときに実行される JavaScript を指定します。


ブラウザのサポート

QQ截图20161108165429.png

すべての主要なブラウザが onmousemove イベントをサポートしています


このイベントをサポートする HTML タグ:

onmousemove 属性は、<base> を除く HTML 要素を使用するために使用できます。 <bdo>、<br>、 <head>、<html>、<iframe>、<meta>、<param>、<script>、<style>、 と <title>。