HTMLFormElement.elements
小结
elements 返回一个 HTMLFormControlsCollection
(en-US) (HTML 4 HTMLCollection
) 其中包含FORM的所有控件。需要注意的是,其中不包括
image的type等于
input
元素。
语法
nodeList = HTMLFormElement.elements
实例
var inputs = document.getElementById("form1").elements;
var inputByIndex = inputs[2];
var inputByName = inputs["login"];