JavaScript

Moderators: None (Apply to moderate this forum)
Number of threads: 2058
Number of posts: 5158

This Forum Only
Post New Thread
Single Post View       Linear View       Threaded View      f

Report
Where or what is here the condition Posted by jabo on 18 Jul 2001 at 8:30 AM
Learning about JavaScript I have all sorts of problems, which I don't unterstand.
For instance,I found in a program the following:

if (document.all){
var wide = window.screen.availWidth;
var high = window.screen.availHeight;
}

Now.
All the books say that the SYNTAX for IF is

if(condition){
statement(s) if true
}

But in this case it is written

if(document.all).


Is that a condition?


If yes, what condition is it then?
Could anybody give me a hint, please,
what that condition could be?

Thank you!
Jabo

Jabo

Report
Re: Where or what is here the condition Posted by christopherN on 24 Jul 2001 at 2:31 PM
the SYNTAX that they book shows is just a prototype for the format, where (condition) is any condition. The snippet that you provided seems to check that the document is loaded [condition will return an object], and then assigns the values to the variables.

: Learning about JavaScript I have all sorts of problems, which I don't unterstand.
: For instance,I found in a program the following:
:
: if (document.all){
: var wide = window.screen.availWidth;
: var high = window.screen.availHeight;
: }
:
: Now.
: All the books say that the SYNTAX for IF is
:
: if(condition){
: statement(s) if true
: }
:
: But in this case it is written
:
: if(document.all).
:
:
: Is that a condition?
:
:
: If yes, what condition is it then?
: Could anybody give me a hint, please,
: what that condition could be?
:
: Thank you!
: Jabo
:
: Jabo
:


Report
Re: Where or what is here the condition Posted by hsk14 on 25 Jul 2001 at 10:30 AM
: Learning about JavaScript I have all sorts of problems, which I don't unterstand.
: For instance,I found in a program the following:
:
: if (document.all){
: var wide = window.screen.availWidth;
: var high = window.screen.availHeight;
: }
:
: Now.
: All the books say that the SYNTAX for IF is
:
: if(condition){
: statement(s) if true
: }
:
: But in this case it is written
:
: if(document.all).
:
:
: Is that a condition?
:
:
: If yes, what condition is it then?
: Could anybody give me a hint, please,
: what that condition could be?
:
: Thank you!
: Jabo
:
: Jabo
:
Basically, document.all is returning a true or false condition, to see if the document was loaded. if (something) can take any condition as long as it is true or false.






 

Recent Jobs

Official Programmer's Heaven Blogs
Web Hosting | Browser and Social Games | Gadgets

Popular resources on Programmersheaven.com
Assembly | Basic | C | C# | C++ | Delphi | Flash | Java | JavaScript | Pascal | Perl | PHP | Python | Ruby | Visual Basic
© Copyright 2011 Programmersheaven.com - All rights reserved.
Reproduction in whole or in part, in any form or medium without express written permission is prohibited.
Violators of this policy may be subject to legal action. Please read our Terms Of Use and Privacy Statement for more information.
Operated by CommunityHeaven, a BootstrapLabs company.