document.getElementById() VS. getElementById()

前端 未结 6 1428
情书的邮戳
情书的邮戳 2020-12-07 03:43

It is common for me to register javascript functions for certain events by doing something like:

myBtn.Attributes.Add(\"onClick\", \"Validate(getElementById(         


        
6条回答
  •  执笔经年
    2020-12-07 03:51

    I dont really know how to explain it but its because the getElementById() finds an element in the html structure of a page. Some browsers know that by default you want to search the document, but other browsers need that extra guidance hence document.

提交回复
热议问题