PDA

View Full Version : What does this mean???



usdream
10-15-2004, 03:18 AM
And can someone please explain the following coding from Dynamic Drive's tab menu to me?

var menuobj=document.getElementById? document.getElementById("describe") : document.all? document.all.describe : document.layers? document.dep1.document.dep2 : ""

Regards,
Phoebe

ddadmin
10-15-2004, 05:24 AM
It's basically referencing the element on the page with ID="describe" using 3 different methods, depending on whether the browser is DOM compliant, IE4, or NS4, respectively. For example:

document.getElementById("describe")

accesses the element using the DOM.

usdream
10-15-2004, 10:10 AM
It's basically referencing the element on the page with ID="describe" using 3 different methods, depending on whether the browser is DOM compliant, IE4, or NS4, respectively. For example:

document.getElementById("describe")

accesses the element using the DOM.

First, thank you for your reply.

Second, another 2 questions, 1.why do they put a question mark behind the document.getElementById @ the first time?

2.function resetit(e){
if (document.all&&!menuobj.contains(e.toElement))
delayhide=setTimeout("showit(-1)",delay_hide)
else if (document.getElementById&&e.currentTarget!= e.relatedTarget&& !contains_ns6(e.currentTarget, e.relatedTarget))
delayhide=setTimeout("showit(-1)",delay_hide)
} <=== what is this function for?




Regards,
Phoebe

ddadmin
10-18-2004, 08:19 PM
To answer your questions:

1) The question mark is called the Conditional Operator in JavaScript- a shorthand if/else logic statement if you will. For more info, see bottom of: http://www.javascriptkit.com/jsref/operators.shtml

2) Are you referring to function resetit() in general?