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

Manual de Referência HTML

大全 de etiquetas HTML

Propriedade onmouseover em HTML

A propriedade onmouseover é usada para obter ou definir a função de manipulação de eventos do evento mouseover do elemento atual

HTML event attributes

Exemplo Online

O script é executado quando o ponteiro do mouse está sobre a imagem:

<!DOCTYPE html>
<html>
<head>
<title>Uso da propriedade onmouseover em HTML (Tutorial Básico da Web oldtoolbag.com)</title>
</head>
<body>
<img onmouseover="bigImg(this)" onmouseout="normalImg(this)" border="0" src="pig.gif" alt="pig" width="32" height="32">
<p>Quando o usuário passar o mouse sobre a imagem, será acionada a função bigImg(). Esta função ampliará a imagem.
Quando o ponteiro do mouse sai da imagem, será acionada a função normalImg(). Esta função define a altura e largura da imagem como 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 see ‹/›

Browser compatibility

IEFirefoxOperaChromeSafari

All major browsers support the onmouseover event attribute

Definition and usage

The onmouseover attribute is triggered when the mouse pointer is moved over an element.

Tip: The onmouseover attribute is usually used withonmouseoutattributes together.

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