• JS控制显示表单个数


    <html>
    <head>
    <title>Untitled Document</title>
    <meta http-equiv="Content-Type" content="text/html; charset=gb2312">
    </head><LINK href="../hellking.css" type=text/css rel=stylesheet>
    <body>
    <%request.setCharacterEncoding("gb2312"); %>

    <script type="text/javascript">
       function setid()
       {
       str='<br>';
       if(!window.form1.upcount.value)
        window.form1.upcount.value=1;
       if(window.form1.upcount.value>100){
       alert("您最多只能同时上传100个文件0");
       window.form1.upcount.value = 100;
       setid();
       }
       else{
        for(i=1;i<=window.form1.upcount.value;i++)
          str+='<div>文件'+i+':<input type="file" name="file'+i+'"></div><br><br>';
       window.upid.innerHTML=str+'<br>';}
       }
     </script>

    <form name="form1" method="post" action="BookAction_do.jsp?action=${param.action}" >

      <div>
      <table border="1" cellspacing="0" cellpadding="5" bordercolordark="#CCCCCC" bordercolorlight="#000000" bordercolor="#FFFFFF" style="border-collapse: collapse" height="169">
        <tr bgcolor="#CC0CCC">
          <td height="28" align="left" valign="middle" bgcolor="#C0CCCC">&nbsp;
            <div><font size="3"><b>文件上传</b></font></div>
          </td>
        </tr>
        <tr align="left" valign="middle" bgcolor="#eeeeee">
          <td bgcolor="#eeeeee" height="92" valign="top"> <br>
            <table border="0" cellspacing="1" cellpadding="2">

              <tr>
                <td><font color="#FF0000"><b>*</b></font>上传的文件大小不能超过<font color="#FF0000">999999999</font>个字节</td>
              </tr>
              <tr>
                <td>

                  <b><font color="#FF0000">*</font></b>每次可以设置同时上传<font color="#FF0000">100</font>个文件。<br>

                  设置上传的个数
                  <input type="text" value="1" name="upcount" size="20">
                  <input type="button" name="Button"  onClick="setid();" value="设定">

                </td>
              </tr>

            </table>
          </td>
        </tr>
        <tr>
          <td id="upid">
            <div>文件1:
              <input type="file" name="file1">
            </div>
          </td>
        </tr>


      </table>
    </div>
    <br>
      <tr align="center" valign="middle" bgcolor="#eeeeee">
          <td bgcolor="#ccc000" height="33">
            <input type="submit" name="Submit" value="确定">
            <input type="reset" name="Submit2" value="重执">
          </td>
        </tr>
    </table></form>
    </body>
    </html>

  • 相关阅读:
    LF will be replaced by CRLF in package.json.
    JS 防抖和节流
    webpack依赖分析|打包优化
    JavaScript 中精度问题以及解决方案
    mysql查询某些数据的最小值
    mongodb sort
    常用的快捷键(用到时再不断完善)
    一、negut增加Nancy,和Nancy.Hosting.Self,
    Linux系统(Centos)安装tomcat和部署Web项目
    CentOS 7系统安装jdk-8u161-linux-x64.tar.gz
  • 原文地址:https://www.cnblogs.com/huhu/p/123225.html
Copyright © 2020-2023  润新知