473,396 Members | 1,975 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

Unusual javascript code

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;');
}

Jul 23 '05 #1
1 1076
Lee
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.

Jul 23 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: Ken Tuck | last post by:
Hi The following functions are working propery for IE, Ns 4.x and NS 6+ but the image I want to display disappears in IE. Why? function swapPic(layer,imgName,imgObj) { o = (n &&...
1
by: Colin Colin | last post by:
I downloaded a calendar.asp file that someone named Jacob "WickedPisser" Gilley made. It's a few years old but It works fine and it's what I was looking for without getting into ActiveX objects. ...
3
by: Farooq Khan | last post by:
why does Response.Write in a method of code-beind class when called from inpage code (i.e in <%---%>), after creating object of that class, fails when called while it works perfectly ok while...
1
by: Dan | last post by:
HI I am using the SmartNav directive in my aspx page, it does what i expect when i am running locally and testing, but when i upload to my server and run it from there over the web it seems to...
2
by: Neo Geshel | last post by:
Greetings! I have a rather unusual request about a rather basic need. I need to be able to bind data to a page, but WITHOUT using a Repeater, DataGrid or DataList. Why? Well, I have some...
1
by: shellon | last post by:
Hi all: when I use XPather(a firefox extension) to evaluate the expression: "/html/body/table/tbody/tr/td/table/tbody/tr/td/div/ul/li" it tells me there are 7 matching Nodes. but when I use...
1
by: wenijah | last post by:
Hi everyone! First thank you for reading this post and yes, you probably already see that kind of topic title somewhere but the problem I've got today might be different than the 100 topics I've...
5
by: maya | last post by:
(function() { function initProductImagePanels() { var elements = YAHOO.util.Dom.getElementsByClassName('productImage', 'img'); for(var i = 0; i < elements.length; i++) { var el = new...
4
by: rakesh19 | last post by:
Hi, I am dynamically including .js files on a button click. There is a segregated function to do the same. It doesnt seems to work well. If I put a alert tag in the includeJSFile function, it works...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.