当前位置: 首页 > 网络学院 > 客户端脚本教程 > HTML DOM > HTML DOM elements 集合

HTML DOM
DOM Input Checkbox
DOM Input File 对象
DOM Input Hidden对象
DOM Input Password 对象
DOM Input Radio 对象
DOM Input Reset 对象
DOM Input Submit 对象
DOM Input Text 对象
DOM Link 对象
DOM Location 对象
DOM Meta 对象
DOM Navigator 对象
DOM 对象
DOM Option 对象
DOM Screen 对象
DOM Select 对象
DOM Style 对象
DOM Table 对象
DOM TableData 对象
DOM TableHeader 对象

HTML DOM elements 集合


出处:互联网   整理: 软晨网(RuanChen.com)   发布: 2009-03-04   浏览: 403 ::
收藏到网摘: n/a

Definition and Usage
定义与用法

The elements collection returns an array containing each element in the form.
元素集合可返回在包含了表单中每个元素的数组

Syntax
语法

formObject.elements[].property


Example
举例

The following example outputs the value of all the form elements:
下面的举例将输出所有表单中的元素:

<html>
<body>
<form id="myForm">
Firstname: <input id="fname" type="text" value="Mickey" />
Lastname: <input id="lname" type="text" value="Mouse" />
<input id="sub" type="button" value="Submit" />
</form>
<p>得到表单中所有元素的值:<br />
<script type="text/javascript">
var x=document.getElementById("myForm");
for (var i=0;i<x.length;i++)
{
document.write(x.elements[i].value);
document.write("<br />");
}
</script>
</p>
</body>
</html>


演练

Get the value of all form elements
得到所有表单中元素的值

评论 (0) All

登陆 | 还没注册?