日期:2014-05-18  浏览次数:20476 次

遍历所有 input text取值的问题
做一个网络硬盘的东西,其中文件上传部分包括上传文件和每个文件的说明(便于搜索),由于文件可能是多个的,所以需要动态的生成上传文件个数和文件说明

<title> 无标题页 </title>
        <script   language= "javascript ">
    function   setid()
    {

    str= ' ';
    if(!document.form1.upcount.value)
      document.form1.upcount.value=1;
      if   (document.form1.upcount.value> 20)
      {
alert( '上传数目不能大于20! ');
return   false;
      }
    for(i=1;i <=document.form1.upcount.value;i++)
  str+= ' <input   type= "file "   name= "m_file "   contentEditable= "false "   id= "m_file "   class= "kuan "   size= "50 "   maxlength= "100 "> 文件描述: <input   id= "Text1 "   type= "text "   /> <br> ';
    document.getElementById( "upid ").innerHTML=str+ ' <br> ';
    }
    </script>
</head>
<body>
        <form   id= "form1 "   runat= "server "   method= "post "   enctype= "multipart/form-data ">
        <div>
                需上传的个数   : <input   class= "btn "   type= "text "   size= "7 "   value= "5 "   name= "upcount "   id= "upcount ">
<input   onClick= "setid(); "   type= "button "   value= "   设   定   "   name= "Button "   > &nbsp;
                <br   />
                <table>
                <TR   id= "type1 ">
<TD   id= "upid "> <P>
<INPUT   class= "kuan "   contentEditable= "false "   id= "m_file "   type= "file "   maxLength= "100 "   size= "50 "
name= "m_file "> 文件描述: <input   id= "Text1 "   type= "text "   /> </asp:TextBox> </P> </TD>
</TR>
                </table>
        </div>
                <asp:Button   ID= "Button1 "   runat= "server "   Text= "Button "   />
        </form>
</body>
</html>


后台上传文件部分

                Dim   files   As   System.Web.HttpFileCollection   =   System.Web.HttpContext.Current.Request.Files

                '状态信息
                Dim   strMsg   As   New   System.Text.StringBuilder( "上传的文件分别是: <hr   color=red> ")