Padrill
04-25-2003, 06:44 AM
I'm studying the External JS script from javascript.internet.com/forms
And this line is confusing me:
if (!(x = document[strName]) && document.all) x = document.all[strName];
It looks as if it tries to assign document[strName] to x (if there is an element with name=strName and there are elements in the document) otherwise it assigns document.all[strName] to x
Why doesn't it do x=document.all[strName] in the first place?
I suspect that it has to do with browser compatibility but can anyone confirm that please?
Also, does anyone know any good advanced JavaScript Tutorial-Reference - I've had enough with the ones that describe variables and loops.
Thanx.
And this line is confusing me:
if (!(x = document[strName]) && document.all) x = document.all[strName];
It looks as if it tries to assign document[strName] to x (if there is an element with name=strName and there are elements in the document) otherwise it assigns document.all[strName] to x
Why doesn't it do x=document.all[strName] in the first place?
I suspect that it has to do with browser compatibility but can anyone confirm that please?
Also, does anyone know any good advanced JavaScript Tutorial-Reference - I've had enough with the ones that describe variables and loops.
Thanx.