English | 简体中文 | 繁體中文 | Русский язык | Français | Español | Português | Deutsch | 日本語 | 한국어 | Italiano | بالعربية
Die onmouseover-Attribut wird verwendet, um den Event-Handler dermouseover-Ereignis des aktuellen Elements zu erhalten oder zu setzen
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 ‹/›
IEFirefoxOperaChromeSafari
All major browsers support the onmouseover event attribute
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>.
None.
<element onmouseover="script">
Value | Description |
---|---|
script | Specifies the script to be executed when the onmouseover event is triggered. |