html element id as javascript variable

前端 未结 3 1997
后悔当初
后悔当初 2021-02-19 16:43

Consider the following code:





      
3条回答
  •  清歌不尽
    2021-02-19 17:31

    It's an old IE feature, not recommended to use. Several browsers implement it, often as nonenumerable properties of the window object. FF, for example, does it only in quirks mode.

    For further reading see duplicate Is there a spec that the id of elements should be made global variable?...

提交回复
热议问题