Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations wOOdy-Soft on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Explaination of javascript e.g: nest=(!nest) ? "":

Status
Not open for further replies.

dijo123

Programmer
Jan 13, 2004
30
SE
What does this function return?
What does the first row mean, would you explain what nest will have for value. I don't understand the ?"":

Thank you for helping me!

function makeMenu(obj,nest){
nest=(!nest) ? "":'document.'+nest+'.';
this.css= bw.dom? document.getElementById obj).style:bw.ie4?document.all[obj].style:bw.ns4?eval(nest+"document.layers." +obj):0;

this.elm= bw.dom?document.getElementById(obj):bw.ie4?document.all[obj]:bw.ns4?eval(nest+'document.'+obj):0;

this.ref= bw.dom || bw.ie4? document:bw.ns4?eval(nest+"document.layers." +obj+".document"):0;

this.x= bw.ns4?this.css.left:bw.opera5?this.css.pixelLeft:this.elm.offsetLeft;
this.y= bw.ns4?this.css.top:bw.opera5?this.css.pixelTop:this.elm.offsetTop;
this.height= defHeight;//bw.ns4?this.ref.height:bw.opera5?this.css.pixelHeight:this.elm.offsetHeight;
this.status= 0;
return this;
}

 
this is like another simple if else statement

if the variable = value then use the first argument, if not then use the second

eg

var mySum=2
mySum = 2? myVal="two":myVal="No It Doesn't";

alert(myVal)
would alert "two"

Hope this helps

Simon


 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top