Html的一些小东西
Event
cancelBubble
設(shè)置或獲取當(dāng)前事件是否要在事件句柄中向上冒泡。
Sets or retrieves whether the current event should bubble up the hierarchy of event handlers.
<SCRIPT LANGUAGE="JScript">
function checkCancel() {
if (window.event.shiftKey) //只要你按著shift鍵,就不會(huì)再觸發(fā)BODY 的onclick了
window.event.cancelBubble = true;
}
function showSrc() {
if (window.event.srcElement.tagName == "IMG")
alert(window.event.srcElement.src);
}
</SCRIPT>
<BODY οnclick="showSrc()">
<IMG οnclick="checkCancel()" src="sample.gif">
用途:阻止父控件或以上級(jí)控件觸發(fā)相應(yīng)事件
?
轉(zhuǎn)載于:https://www.cnblogs.com/Aldebaran/archive/2008/08/21/1273199.html
與50位技術(shù)專家面對(duì)面20年技術(shù)見證,附贈(zèng)技術(shù)全景圖總結(jié)
以上是生活随笔為你收集整理的Html的一些小东西的全部內(nèi)容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: arcgis flex aqi 3大ut
- 下一篇: 《喜剧之王》- 24/7 - Cagne