so***********@yahoo.com said:
Can someone please explain what !! and e=e doing in the following code
snippet downloaded from
http://www.walterzorn.com/dragdrop/commands_e.htm? Thanks!
function WZDD()
{
this.op = !!(window.opera && document.getElementById);
if (this.op && !this.op6) document.onmousedown = new
Function('e',
'if (((e = e || window.event).target ||
e.srcElement).tagName == "IMAGE") return false;');
}
!!(expresion)
converts the expression to either true or false.
The second ! forces it to a boolean by negating it, and then the first one
undoes the negation.
The other expression isn't "e=e". The || operator has precedence over the
assignment. It's assigning to e the value of:
e || window.event
which is either the value of e, if it has a value, or else the value of
window.event, if e is undefined.