var el=document.forms[0].elements;
for (i=0;i<el.length;i++)
{
if (el[0].type=="input" && el[0].id.indexOf("data")==0)
{
alert(el[0].value);
}
}
for (i=0;i<el.length;i++)
{
if (el[0].type=="input" && el[0].id.indexOf("data")==0)
{
alert(el[0].value);
}
}
可以用索引的方式.循环所有的HTML控件..
用Request.Form(intLoop)进行访问.就不必考虑到ID的问题了..txt.asp<Form action="txt.asp" method="POST">
<input type=text value="灰豆宝宝.net" name="txt45">
<input type=text value="灰豆大仙.net" name="txt2450">
<input type=submit value="submit">
</Form>
<%
For intLoop=1 To Request.Form.Count
Response.Write Request.Form(intLoop) & "<br>"
Next
%>
or
eval("document.all." + cells[j] + ".value")
试试!
但是,使用document相关好像不行啊,另外,cells[j].children[0].value看上去最简单,但是,运行显示“cells[...].children.0..value为空或不是对象”;我把cells[j].children[0].value改为cells[j].child.value也不行,怎么回事啊??????
各位大侠,多谢了!!!!!
呵呵,其实 anita2li(hehe...) 的办法是可行的,只是我犯了一个低级错误(脸红。)
谢谢大家的帮助!!!!!!