document.getElementById().xxxx括号里写对应的id值
<input type="text" id="name" name="name" maxLength="15" size="20>
document.getElementByName().xxxx
<input type="text" id="name" name="name" maxLength="15" size="20>
document.getElementByName().xxxx
document.getElementById
你的全都是name,怎么能取得到值
要么设置 属性id="name";
Name属性必须特殊对待,只要如此创建就能找到了。
MSDN原文如此:
Attributes can be included with the sTag as long as the entire string is valid HTML. You should do this if you wish to include the NAME attribute at run time on objects created with the createElement method.
这里通过ID得到的 document.getElementById("aa").value
而这里是name,家庭住址:<input type="text" maxLength="15" size="20" name="aa />