日韩av黄I国产麻豆传媒I国产91av视频在线观看I日韩一区二区三区在线看I美女国产在线I麻豆视频国产在线观看I成人黄色短片

歡迎訪問 生活随笔!

生活随笔

當(dāng)前位置: 首頁 >

JavaScript onmouseup 事件

發(fā)布時(shí)間:2025/3/15 31 豆豆
生活随笔 收集整理的這篇文章主要介紹了 JavaScript onmouseup 事件 小編覺得挺不錯(cuò)的,現(xiàn)在分享給大家,幫大家做個(gè)參考.

Definition and Usage
定義與用法

The onmouseup event occurs when a mouse button is released.
當(dāng)鼠標(biāo)按鍵松開時(shí)觸發(fā)onmouseup事件

Syntax
語法

οnmοuseup="所要執(zhí)行的代碼"

Parameter
參數(shù)Description
注釋
SomeJavaScriptCode
所要執(zhí)行的代碼
Required. Specifies a JavaScript to be executed when the event occurs.
必選項(xiàng)。當(dāng)時(shí)間觸發(fā)時(shí)所要執(zhí)行的代碼

Supported by the following HTML tags:
所支持的HTML標(biāo)簽:

<a>, <address>, <area>, <b>, <bdo>, <big>, <blockquote>, <body>, <button>, <caption>, <cite>, <code>, <dd>, <dfn>, <div>, <dl>, <dt>, <em>, <fieldset>, <form>, <h1> to <h6>, <hr>, <i>, <img>, <input>, <kbd>, <label>, <legend>, <li>, <map>, <ol>, <p>, <pre>, <samp>, <select>, <small>, <span>, <strong>, <sub>, <sup>, <table>, <tbody>, <td>, <textarea>, <tfoot>, <th>, <thead>, <tr>, <tt>, <ul>, <var>

Supported by the following JavaScript objects:
所支持的JavaScript對(duì)象:

button, document, link


Example 1
實(shí)例1

In this example an alert box is displayed when the mouse button is released after clicking the picture:
在下面的例子中,當(dāng)你點(diǎn)擊圖片并松開鼠標(biāo)時(shí)將彈出一個(gè)消息框:

<img src="image_w3default.gif"
οnmοuseup="alert('你點(diǎn)擊過圖片')">

The output of the code above will be (click on the picture):
上述代碼的輸出結(jié)果為:



Example 2
實(shí)例2

In this example an alert box will alert the tag name of the element you clicked on:
在下面的例子中,彈出的消息框?qū)@示你所點(diǎn)擊過的元素名稱:

<html>
<head>
<script type="text/javascript">
function whichElement(e)
{
var targ
if (!e) var e = window.event
if (e.target) targ = e.target
else if (e.srcElement) targ = e.srcElement
if (targ.nodeType == 3) // defeat Safari bug
targ = targ.parentNode
var tname
tname=targ.tagName
alert("You clicked on a " + tname + " element.")
}
</script>
</head> <body οnmοuseup="whichElement(event)"> <h2>This is a header</h2>
<p>This is a paragraph</p>
<img border="0" src="ball16.gif" alt="Ball"> </body>
</html>


Try-It-Yourself Demos
互動(dòng)演示

onmouseup
How to use onmouseup to display an alert box when an image is clicked.
如何應(yīng)用onmouseup事件在點(diǎn)擊一張圖片后彈出消息框

onmouseup 2
How to use onmouseup to alert the tag name of the element you clicked on.
如何應(yīng)用onmouseup事件和消息框顯示你所點(diǎn)擊的元素名稱。
轉(zhuǎn)載 http://www.w3pop.com/tech/school/jsref/jsref_onmouseup.asp

轉(zhuǎn)載于:https://www.cnblogs.com/yzxchoice/archive/2007/01/10/616463.html

總結(jié)

以上是生活随笔為你收集整理的JavaScript onmouseup 事件的全部?jī)?nèi)容,希望文章能夠幫你解決所遇到的問題。

如果覺得生活随笔網(wǎng)站內(nèi)容還不錯(cuò),歡迎將生活随笔推薦給好友。