[Javascript] code deciphering help
Rodney Myers
rodney at aflyingstart.net
Wed Jun 20 12:16:39 CDT 2001
This is the structure of the "inline conditional" :
variable = condition ? value_if_true : value_if_false
it is equivalent to :
if(condition)
{
variable = value_if_true;
}
else
{
variable = value_if_false;
}
valueToYou=(Understood)?High:Zero // <G>
Rodney
David Levy wrote:
> Hi, I was wondering if anyone can make sense of this little snippet of
> code: y=(nav)?e.pageY:event.y+document.body.scrollTop;skn.top=y+yyy; my
> experience with javascript is very limited. Here's what I do know.
> nav is a boolean variable, I believe skn is an object, and I
> understand that there is some sort of assignment going on. What
> primarily confuses me is the question mark(?) and the colon(:). The
> code comes from a script written by Mike McGrath. Thank you to anyone
> willing to take a look. David Levy
--
Shop at ssistant Add-ons and Developer Workshops
http://www.aflyingstart.net/addons/
Enquiries regarding Shop at ssistant Classic training :
Call 01256 880770
Rodney Myers
Based in Oxford, England
Technical Director, Shop at ssistant eCommerce Solutions
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.evolt.org/pipermail/javascript/attachments/20010620/2eaadb36/attachment.htm>
More information about the Javascript
mailing list