...

View Full Version : is start() reserved?



Kor
06-09-2008, 04:19 PM
Just a curiosity:

It looks like IE (and IE only) treats start as a reserved or used word in constructions like:


<input type="whichever" onclick="start()">

As it does not appear to be a reserved javascript word, I suspect IE takes it as an ActionScript method, even I might be wrong...

Anyway, if so, I wonder why in a construction like:


<span onclick="start()">click</span>

IE accepts now the name start for the called function. Why this lack of consistency?

Any explanation?

marcusami
06-09-2008, 09:40 PM
did it use to be available for a windows media? wasnt there a start() pause() stop() function for their objects? i might be crazy

regards
KOR OWNS ROMANIA
and JAVASCRIPT FORUMS!

regards
Marcus

liorean
06-09-2008, 10:24 PM
Kor: It's because in ie, input elements have a property named start. When you write script inline in an event handler, the scope of that event handler will contain all the properties of the form control itself, outside that scope will be the form itself, I'm not sure but I believe the document may come next in the scope hierarchy, and the window object comes at the bottom of the scope chain. As such, a property name on the input element will shadow a function name on the window object.

Kor
06-10-2008, 10:39 AM
Thanks, liorean! That makes sense.



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum