Why can only forms be referenced by dot notation?

后端 未结 2 366
萌比男神i
萌比男神i 2021-01-13 18:19

It seems like a simple beginners question, but I\'m unable to find an answer anywhere.

Let\'s say I have this HTML:

&
2条回答
  •  余生分开走
    2021-01-13 18:53

    As designed by W3C.

    There's really nothing to argue about. You can access the an HTMLCollection of all the forms on the page through document.forms, much like you can images with document.images, applets with document.applets, links with document.links and anchors with document.anchors.

    http://www.w3.org/TR/DOM-Level-2-HTML/html.html#ID-1689064

提交回复
热议问题