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

HTML Referenzhandbuch

Vollständiges Verzeichnis der HTML-Tags

HTML onmouseover-Ereignisattribut

Die onmouseover-Attribut wird verwendet, um den Event-Handler dermouseover-Ereignis des aktuellen Elements zu erhalten oder zu setzen

HTML Event Attributes

Online-Beispiel

Das Skript wird ausgeführt, wenn der Mauszeiger auf das Bild kommt:

<!DOCTYPE html>
<html>
<head>
<title>Verwendung der onmouseover-Eventattribut in HTML (Grundlagen-Tutorial-Netz)3codebox.com)</title>
</head>
<body>
<img onmouseover="bigImg(this)" onmouseout="normalImg(this)" border="0" src="pig.gif" alt="pig" width="32" height="32">
<p>Wenn der Benutzer den Mauszeiger auf das Bild bewegt, wird die Funktion bigImg() ausgelöst. Diese Funktion vergrößert das Bild.
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>
Test it out ‹/›

Browser Compatibility

IEFirefoxOperaChromeSafari

All major browsers support the onmouseover event attribute

Definition and Usage

is triggered when the mouse pointer is moved over an element.

Tip: The onmouseover attribute is usually used withonmouseoutused together with the attribute.

Note: The onmouseover attribute cannot be used with the following elements: <base>, <bdo>, <br>, <head>, <html>, <iframe>, <meta>, <param>, <script>, <style>, or <title>.

HTML 4.01 With HTML5Differences

None.

Syntax

<element onmouseover="script">

Attribute Value

ValueDescription
scriptSpecifies the script to be executed when the onmouseover event is triggered.
HTML Event Attributes