English | 简体中文 | 繁體中文 | Русский язык | Français | Español | Português | Deutsch | 日本語 | 한국어 | Italiano | بالعربية

HTML Referenzhandbuch

Vollständiges Verzeichnis der HTML-Tags

HTML onmousemove-Event-Attribut

Die onmousemove-Attribut wird verwendet, um den aktuellen Event-Handler der mousemove-Ereignis für das aktuelle Element zu erhalten oder zu setzen

HTML Event Attributes

Online-Beispiel

Führe JavaScript aus, wenn der Mauszeiger auf das Bild gelegt wird:

<!DOCTYPE html>
<html>
<head>
<title>Verwendung der HTML onmousemove-Event-Attribut (Grund教程网 oldtoolbag.com)</title>/title>
</head>
<body>
<img onmousemove="bigImg(this)" onmouseout="normalImg(this)" border="0" src="pig.gif" alt="pig" width="32" height="32">
<p>Wenn der Mauszeiger auf das Bild gelegt wird, wird die Funktion bigImg() ausgelöst. Diese Funktion vergrößert das Bild.<br>
Wenn der Mauszeiger aus dem Bild herausgeht, wird die Funktion normalImg() ausgelöst. Diese Funktion setzt die Höhe und Breite des Bildes auf normal./p>
<script>
function bigImg(x) {
  x.style.height = "64px";
  x.style.width = "64px";
}
function normalImg(x) {
  x.style.height = "32px";
  x.style.width = "32px";
}
</script>
</body>
</html>
测试看看 ‹/›

浏览器兼容性

IEFirefoxOperaChromeSafari

所有主流浏览器都支持 onmousemove 事件属性

定义和用法

当指针在元素上移动时,onmousemove属性将触发。

注意: The onmousemove attribute cannot be used on the following elements: <base>, <bdo>, <br>, <head>, <html>, <iframe>, <meta>, <param>, <script>, <style>, or <title>.

HTML 4.01 With HTML5The Differences

None.

Syntax

<element onmousemove="script">

Attribute Value

ValueDescription
scriptSpecify the script to be executed when the onmousemove event is triggered.
HTML Event Attributes