Win a copy of Functional Reactive Programming this week in the Other Languages forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

what is this 'if' condition?

 
ankur rathi
Ranch Hand
Posts: 3830
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator


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
Posts: 15385
6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 3830
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 15385
6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 2596
Android Firefox Browser Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
onBlur would be a better idea.

- manish
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic