[Javascript] code deciphering help
Ben Curtis
Quixote at LaMancha.org
Wed Jun 20 12:22:44 CDT 2001
> y=(nav)?e.pageY:event.y+document.body.scrollTop;
> skn.top=y+yyy;
>
> ... What primarily confuses
> me is the question mark(?) and the colon(:).
This:
y=(nav)?e.pageY:event.y+document.body.scrollTop;
...can be rewritten as this:
if (nav) {
y = e.pageY;
} else {
y = event.y + document.body.scrollTop;
}
This is some code that creates a value y in one way for Netscape4 and
another way for IE. It then places the skn layer vertically at the position
y, plus some modifier yyy.
+Ben Curtis
...just this guy, you know?
More information about the Javascript
mailing list