D
disappearedng
Hi everyone
I am currently confused about a piece of code that I have encountered:
1) Is e here an event?
2) what's the purpose of e = (!e) ? window.event : e; //get the event
3) What's if (target.nodeType == 3)
target = target.parentNode;'
4) What does this piece of code do?
I am currently confused about a piece of code that I have encountered:
Code:
function handleKeyUp(e){
e = (!e) ? window.event : e; //get the event
target = (!e.target) ? e.srcElement : e.target; //get the event's
target
if (target.nodeType == 3)
target = target.parentNode;
if (e.charCode)
code = e.charCode;
else
if (e.keyCode)
code = e.keyCode;
else
if (e.which)
code = e.which;
else
code = 0;
if (e.type == "keyup") {
isKeyUpDownPressed = false;
1) Is e here an event?
2) what's the purpose of e = (!e) ? window.event : e; //get the event
3) What's if (target.nodeType == 3)
target = target.parentNode;'
4) What does this piece of code do?