Blogger Information
Blog 4
fans 0
comment 0
visits 5298
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
通过表单给数组赋值
计算机的博客
Original
1167 people have browsed it

var arr=new Array();//定义数组
var myform=document.getElementsByTagName('form')[0];
var xinp=myform.getElementsByTagName('input');//获取表单中所有输入框
for(var i=0;i<xinp.length;i++)//循环
{
    arr[i]=xinp[i].value;//将每个输入框中的值付给数组对应项
}


====


<form name="form1" method="post" action="2.asp">
<table width="95%">
<%
for a=0 to 2
 Response.Write "<tr>"
 for b=0 to 2
 %>
 <td width="33%" height="40"><input name="x(<%=a&","&b%>)" type="text" id="x(a,b)"></td>
 <%
 next
 Response.Write "</tr>"
 next
%>
 <tr>
 <td width="33%" height="40"> </td>
 <td width="33%" height="40"><input type="submit" name="Submit" value="提交"></td>
 <td width="33%" height="40"> </td>
 </tr>
</table>
</form>


name="x(<%=a&","&b%>)"
这你不管name=什么他都只是个字符串
你要把a和b的值传过去,然后用request对象获取
然后再循环付值给数组


===

Statement of this Website
The copyright of this blog article belongs to the blogger. Please specify the address when reprinting! If there is any infringement or violation of the law, please contact admin@php.cn Report processing!
All comments Speak rationally on civilized internet, please comply with News Comment Service Agreement
0 comments
Author's latest blog post