教程集 www.jiaochengji.com
教程集 >  脚本编程  >  javascript  >  正文 js 动态增加file实现多文件上传功能

js 动态增加file实现多文件上传功能

发布时间:2017-02-10   编辑:jiaochengji.com
教程集为您提供js 动态增加file实现多文件上传功能等资源,欢迎您收藏本站,我们将为您提供最新的js 动态增加file实现多文件上传功能资源
提示:您可以先修改部分代码再运行

<textarea name="runcool" rows="28" cols="75" > <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=gb2312" /> <title>无标题文档</title> </head> <body> <script language="javascript"> //全局变量,代表文件域的个数,并用该变量区分文件域的name属性 var file_count = 0; //增加文件 域 function additem(id) { if (file_count > 9) { alert("最u22810 10个u25991 件u22495 "); return; } //定义行变量row;单元格变量cell;单元格内容变量str。 var row,cell,str; //在指定id的table中插入一行 row = eval("document.all[" '"' id '"' "]").insertRow(); if(row != null ) { //设置行的背景颜色 row.bgColor="white"; //在行中插入单元格 cell = row.insertCell(); //设置str的值,包括一个文件域和一个删除按钮 str=''; str = " "; //文件域个数增加 file_count ; //设置单元格的innerHTML为str的内容 cell.innerHTML=str; } } //删除文件域 function deleteitem(obj,id) { var rowNum,curRow; curRow = obj.parentNode.parentNode; rowNum = eval("document.all." id).rows.length - 1; eval("document.all[" '"' id '"' "]").deleteRow(curRow.rowIndex); file_count--; } </script> html代码:
<table cellspacing="0" id="tb" style="width:400px"> </table> </body> </html> </textarea>
提示:您可以先修改部分代码再运行

您可能感兴趣的文章:
js 动态增加file实现多文件上传功能
实例讲解H5移动开发Ajax上传多张Base64格式图片到服务器
php文件上传代码大全(实例分享)
22个很棒的jQuery文件上传插件
php自动创建文件夹并上传文件
php 文件上传实例剖析
jQuery动态添加 input type=file的实现代码
PHP 图片文件上传的原理分析与代码
在ASP.NET中实现多文件上传
php实现文件的自动ftp更新

[关闭]
~ ~