码迷,mamicode.com
首页 > Web开发 > 详细

关于js动态添加上传文件框

时间:2014-09-10 14:22:11      阅读:267      评论:0      收藏:0      [点我收藏+]

标签:js   动态   上传文件   file   元素   

主要的js方法如下:

function addRow(){

    var input = document.createElement(‘input‘);

    input.setAttribute("type","file");

    input.setAttribute("size","55");

    input.setAttribute("name","theFile");

    $("#theFile").after(input);

    $("#theFile").after(document.createElement("BR"));

}


jsp页面中的元素如下:

<TR>

  <th width="137" align="right"><strong>文件选择:</strong></tdh>

  <TD vAlign=top>

      <input name="theName" type="hidden" size="40">

      <input class="formInputText" name=theFile id="theFile" type=file size="60"  onpropertychange="MM_changeProp2(this.value)">

      <input type="button" id="filebtn" name="filebtn" class="formInputText" value="继续添加" onclick="addRow()">

   </TD>

</TR>

效果图如下:

bubuko.com,布布扣

关于js动态添加上传文件框

标签:js   动态   上传文件   file   元素   

原文地址:http://butcher36.blog.51cto.com/9315484/1550496

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!