ÍøÂçѧԺ w3popÉçÇø ÍøÂç×ÊÔ´ ITÐÂÎÅ

w3pop.com :: ÍøÂçѧԺ :: HTML DOM :: HTML DOM elements ¼¯ºÏ

»áÔ±µÇ½

ÕʺÅ

ÃÜÂë

»Ø´ð

¼ÇסÃÜÂë

Íü¼ÇÃÜÂë? ×¢²á

HTML DOM elements ¼¯ºÏ


×÷Õß:w3pop.com ·­Òë/ÕûÀí:w3pop.com ·¢²¼:2007-04-28 ä¯ÀÀ:2174 :: ::

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