熱點推薦:
您现在的位置: 電腦知識網 >> 編程 >> Java編程 >> JSP教程 >> 正文

Javascript控制顯示表單個數

2013-11-15 11:34:43  來源: JSP教程 

  <html>
<head>
<title>Untitled Document</title>
<meta httpequiv=ContentType content=text/html; charset=gb>
</head><LINK type=text/css rel=stylesheet>
<body>
<%requestsetCharacterEncoding(gb); %>

<script type=text/javascript>
   function setid()
   {
   str=<br>;
   if(!windowformupcountvalue)
    windowformupcountvalue=;
   if(windowformupcountvalue>){
   alert(您最多只能同時上傳個文件);
   windowformupcountvalue = ;
   setid();
   }
   else{
    for(i=;i<=windowformupcountvalue;i++)
      str+=<div>文件+i+:<input type=file name=file+i+></div><br><br>;
   windowupidinnerHTML=str+<br>;}
   }
 </script>
<form name=form method=post action=BookAction_dojsp?action=${paramaction} >

  <div>
  <table border= cellspacing= cellpadding= bordercolordark=#CCCCCC bordercolorlight=# bordercolor=#FFFFFF height=>
    <tr bgcolor=#CCCCC>
      <td height= align=left valign=middle bgcolor=#CCCCC>&nbsp;
        <div><font size=><b>文件上傳</b></font></div>
      </td>
    </tr>
    <tr align=left valign=middle bgcolor=#eeeeee>
      <td bgcolor=#eeeeee height= valign=top> <br>
        <table border= cellspacing= cellpadding=>

  <tr>
            <td><font color=#FF><b>*</b></font>上傳的文件大小不能超過<font color=#FF></font>個字節</td>
          </tr>
          <tr>
            <td>

  <b><font color=#FF>*</font></b>每次可以設置同時上傳<font color=#FF></font>個文件<br>

  設置上傳的個數
              <input type=text value= name=upcount size=>
              <input type=button name=Button  onClick=setid(); value=設定>

  </td>
          </tr>

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

  </table>
</div>
<br>
  <tr align=center valign=middle bgcolor=#eeeeee>
      <td bgcolor=#ccc height=>
        <input type=submit name=Submit value=確定>
        <input type=reset name=Submit value=重執>
      </td>
    </tr>
</table></form>
</body>
</html>


From:http://tw.wingwit.com/Article/program/Java/JSP/201311/19239.html
    推薦文章
    Copyright © 2005-2013 電腦知識網 Computer Knowledge   All rights reserved.