

#
“onauxclick”イベントハンドラ
イベント名 | “auxclick”イベント |
インターフェース | “PointerEvent”インターフェース |
バブリング | Yes |
キャンセル | Yes |
“onauxclick”イベントハンドラは要素がポインタ・デバイスのメインのボタン以外でクリックされた時に発生する“auxclick”イベントを処理するためのイベントハンドラです。
“auxclick”イベントはポインタ・デバイスで要素が指し示されている時にポインタ・デバイスのメインのもの以外のボタンが押されて放された時に発生します。
“auxclick”イベントの前には“mousedown”イベントと“mouseup”イベントが先行する場合があります。
“onauxclick”イベントハンドラはすべてのHTMLの要素でコンテント属性とIDL属性として使用できます。また、すべての“Document”オブジェクトと“Window”オブジェクトでIDL属性として使用できます。
#
サンプルコード
IDL属性
var count = 0;
document.getElementById("sampleElement").onauxclick = function() {
count++;
document.getElementById("counterNumber").innerHTML = count;
};
<div id="sampleElement">♪</div>
<p>イベントの発生回数:<output id="counterNumber">0</output>回</p>
♪
イベントの発生回数:回
コンテント属性
var count = 0;
function counter(){
count++;
document.getElementById("counterNumber").innerHTML = count;
};
<div onauxclick="counter();">♪</div>
<p>イベントの発生回数:<output id="counterNumber">0</output>回</p>
♪
イベントの発生回数:回
#