除了用getElementByTagName 的另一种获取对象集合的方法 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=gb2312" /> <title>无标题文档</title> </head> <body> <form id="one" name="one"> <input type="text" title="sadf" sd="sdf" name="hello" id="hello" value="1" /> <input type="text" name="hello" sd="sasdfasdf" id="hello" value="2" /> <input type="text" name="hello" id="hello" value="3" /> <input type="text" name="hello" id="hello" value="4" /> <input type="text" name="hello" id="hello" value="5" /> <input type="text" name="hello" id="hello" value="6" /> <input type="text" name="hello" id="hello" value="7" /> <input type="text" name="hello" id="hello" value="8" /> <input type="button" name="ss" value="44" οnclick="javascript:ss();" /> </form> <mce:script type="text/javascript" language="javascript"><!-- function ss(){ var ss = getFiles(); alert(ss[1].sd); } function getFiles(){ var files = new Array(); var inputs = document.getElementsByTagName("input"); for(var i=0;i<inputs.length;i++) { files[i] = inputs[i]; } return files; } window.οnlοad=ss; // --></mce:script> </body> </html>