日韩性视频-久久久蜜桃-www中文字幕-在线中文字幕av-亚洲欧美一区二区三区四区-撸久久-香蕉视频一区-久久无码精品丰满人妻-国产高潮av-激情福利社-日韩av网址大全-国产精品久久999-日本五十路在线-性欧美在线-久久99精品波多结衣一区-男女午夜免费视频-黑人极品ⅴideos精品欧美棵-人人妻人人澡人人爽精品欧美一区-日韩一区在线看-欧美a级在线免费观看

歡迎訪問 生活随笔!

生活随笔

當前位置: 首頁 > 前端技术 > javascript >内容正文

javascript

JavaScript onmouseup 事件

發布時間:2025/3/15 javascript 27 豆豆
生活随笔 收集整理的這篇文章主要介紹了 JavaScript onmouseup 事件 小編覺得挺不錯的,現在分享給大家,幫大家做個參考.

Definition and Usage
定義與用法

The onmouseup event occurs when a mouse button is released.
當鼠標按鍵松開時觸發onmouseup事件

Syntax
語法

οnmοuseup="所要執行的代碼"

Parameter
參數Description
注釋
SomeJavaScriptCode
所要執行的代碼
Required. Specifies a JavaScript to be executed when the event occurs.
必選項。當時間觸發時所要執行的代碼

Supported by the following HTML tags:
所支持的HTML標簽:

<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對象:

button, document, link


Example 1
實例1

In this example an alert box is displayed when the mouse button is released after clicking the picture:
在下面的例子中,當你點擊圖片并松開鼠標時將彈出一個消息框:

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

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



Example 2
實例2

In this example an alert box will alert the tag name of the element you clicked on:
在下面的例子中,彈出的消息框將顯示你所點擊過的元素名稱:

<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
互動演示

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

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

轉載于:https://www.cnblogs.com/yzxchoice/archive/2007/01/10/616463.html

總結

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

如果覺得生活随笔網站內容還不錯,歡迎將生活随笔推薦給好友。