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

HTML Reference Manual

HTML tag大全

HTML onmouseup event attribute

The onmouseup attribute is used to get or set the event handler function for the mouseup event of the current element

Atributos de eventos HTML

Online Example

Execute JavaScript when the mouse button is released over the paragraph:

<!DOCTYPE html>
<html>
<head>
<title>Using the HTML onmousedown event attribute (Basic Tutorial Website oldtoolbag.com)</title>
</head>
<body>
<p id="p1" onmousedown="mouseDown()" onmouseup="mouseUp()">
Click the text! When the mouse button is pressed on this paragraph, the mouseDown() function will be triggered. This function sets the text color to red. The mouseUp() function will be triggered when the mouse button is released. The mouseUp() function sets the text color to green.</p>
<script>
function mouseDown() {
  document.getElementById("p1").style.color = "red";
}
function mouseUp() {
  document.getElementById("p1").style.color = "green";
}
</script>
</body>
</html>
Test and see ‹/›

The mouseup event is triggered when the user releases a mouse button over the current element

browser compatibility

IEFirefoxOperaChromeSafari

Todos os navegadores populares suportam o atributo de evento onmouseup

Definição e uso

O atributo onmouseup é acionado quando o botão do mouse é liberado sobre o elemento.

Dica: ordem de ativação dos eventos relacionados ao evento onmouseup (botão esquerdo):/botão do meio do mouse):

  • onmousedown

  • onmouseup

  • onclick

  • ordem de ativação dos eventos relacionados ao evento onmouseup (botão direito do mouse):

  • onmousedown

  • onmouseup

  • oncontextmenu

Atenção: O atributo onmouseup não pode ser usado nos seguintes elementos: <base>, <bdo>, <br>, <head>, <html>, <iframe>, <meta>, <param>, <script>, <style>, ou <title>.

HTML 4.01 e HTML5diferenças entre

Nenhuma.

Sintaxe

<elemento onmouseup="script">

Valor do atributo

ValorDescrição
scriptDefine o script a ser executado quando o evento onmouseup for acionado.


Atributos de eventos HTML