init
This commit is contained in:
parent
06f61d8ce8
commit
f301cb744d
2271 changed files with 103162 additions and 0 deletions
13
02-ui/02-events-and-interfaces/04-event-bubbling/both/script.js
Executable file
13
02-ui/02-events-and-interfaces/04-event-bubbling/both/script.js
Executable file
|
@ -0,0 +1,13 @@
|
|||
|
||||
var elems = document.querySelectorAll('form,div,p');
|
||||
|
||||
for(var i=0; i<elems.length; i++) {
|
||||
elems[i].addEventListener("click", highlightThis, true);
|
||||
elems[i].addEventListener("click", highlightThis, false);
|
||||
}
|
||||
|
||||
function highlightThis() {
|
||||
this.style.backgroundColor = 'yellow';
|
||||
alert(this.tagName);
|
||||
this.style.backgroundColor = '';
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue