PDA

View Full Version : setTimeout() and clearTimeout() issues


n8thegreat
07-31-2003, 06:46 PM
ok, i was really bored today, so i made this stupid game (only works in IE)
http://www.n-son.com/crap/shootcarrottop/

for some reason the timer suddenly speeds up every now and then, and also, for some reason the boundaries for the left and bottom arent working. if anyone knows why, please enlighten me :D

Jon Hanlon
08-01-2003, 08:02 PM
You have an illegal expression in an if statement:
!== 0
It should be == 0 or != 0


The composite syntax for borders is border: width style color
you cannot change the order, so
border: solid 1px #AAAAAA;
won't work.



http://msdn.microsoft.com/workshop/author/dhtml/reference/properties/border_0.asp

n8thegreat
08-01-2003, 08:43 PM
well, i got it all to work anyways :P

how is !== illegal, i use it all the time in php and javascript, and it always works

Vincent Puglia
08-02-2003, 12:45 PM
Hi,

how is !== illegal, i use it all the time in php and javascript, and it always works
What you may have found may be a bug or a well-kept secret. I briefly tested it -- alert(1 != 1)--with NN4.7 & IE 6.1, and yes it does seem to work. However, just because it works now, doesn't necessarily mean you should use it. Somewhere along the line, the browsers may not accept it as a valid operator.

BTW: The acceptable/more popular syntax is "!=" -- one equal sign.

Vinny

Jon Hanlon
08-03-2003, 09:39 PM
Actually, !== is legal in Javascript 1.2 onwards as the 'strictly not equal' operator. This is like the unequal operator (!=), but no type conversion is done.

Equality (==, !=)
If the types of the two expressions are different, attempt to convert them to string, number, or Boolean.
NaN is not equal to anything including itself.
Negative zero equals positive zero.
null equals both null and undefined.
Values are considered equal if they are identical strings, numerically equivalent numbers, the same object, identical Boolean values, or (if different types) they can be coerced into one of these situations.
Every other comparison is considered unequal.


Identity (===, !==)
These operators behave identically to the equality operators except no type conversion is done, and the types must be the same to be considered equal.

php4 also has this operator.

Vincent Puglia
08-04-2003, 11:58 AM
Thanks Jon,

somewhere in the back of the old grey matter, a voice kept nagging "you have seen those operators". But, being lackadaisacal, I didn't get up off my duff to check a manual.

Vinny