1. How to prevent events from bubbling
//Non-IE
if (event && event.stopPropagation)
event.stopPropagation();
else//IE
window.event.cancelBubble = true;
2. Get the control ID
if (document.all) {
//IE
alert(event.srcElement.tagName ":" event.srcElement.id);
}
else {
//Firefox
alert(event.target.tagName ":" event.target.id);
}
Statement:The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn