GeeCON Prague 2014*
The moose likes HTML, CSS and JavaScript and the fly likes what is this 'if' condition? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


JavaRanch » Java Forums » Engineering » HTML, CSS and JavaScript
Bookmark "what is this Watch "what is this New topic
Author

what is this 'if' condition?

ankur rathi
Ranch Hand

Joined: Oct 11, 2004
Posts: 3830


This JS code disabled 'button' if 'contentarea' is empty and enabled if 'contentarea' is not empty.

What I didn't get is, this condition:

if (document.all || document.getElementById)
setInterval("checkifempty()",100)



Thanks.
Eric Pascarello
author
Rancher

Joined: Nov 08, 2001
Posts: 15376
    
    6
whoever wrote that code did not know what event handlers are and wrote a loop that keeps calling the function. Very poorly designed.

Eric
ankur rathi
Ranch Hand

Joined: Oct 11, 2004
Posts: 3830
Originally posted by Eric Pascarello:
whoever wrote that code did not know what event handlers are and wrote a loop that keeps calling the function. Very poorly designed.

Eric


http://www.javascriptkit.com/javatutors/deform4.shtml

I copied code from above link.

Eric Pascarello
author
Rancher

Joined: Nov 08, 2001
Posts: 15376
    
    6
and everything you find on the net is good?

Using intervals is bad when you have a better option such as blur. No wasted memory.

Eric
Manish Hatwalne
Ranch Hand

Joined: Sep 22, 2001
Posts: 2578

onBlur would be a better idea.

- manish
 
GeeCON Prague 2014
 
subject: what is this 'if' condition?