js模拟用户多次点击下载文件
来源:互联网 发布:网络摄像头网线接法 编辑:程序博客网 时间:2024/04/25 23:27
/** * Javascript 多文件下载 * 动态创建a标签,模拟用户多次点击 */function download_files(files) { function download_next(i) { if(i>=files.length) { return; } var a = document.createElement('a'); a.href = files[i]; a.target = '_parent'; // Use a.download if available, it prevents plugins from opening. if ('download' in a) { a.download = files[i].filename; } // Add a to the doc for click to work. (document.body || document.documentElement).appendChild(a); if (a.click) { a.click(); // The click method is supported by most browsers. } else { $(a).click(); // Backup using jquery } // Delete the temporary link. a.parentNode.removeChild(a); // Download the next file with a small timeout. The timeout is necessary // for IE, which will otherwise only download the first file. setTimeout(function () { download_next(i + 1); }, 500); } // Initiate the first download. download_next(0);}
//调用时传入file文件名数组
function multiDown(){var contentsId = $("#contentsId").val();if(contentsId == "" || contentsId == null){return ;}//E07007if($("input[type='checkbox'][name='fileNameCk']:checked").length == 0){warningShow("E07007",getErrorMessage("0","E07007",""));return;}//E07006confirmationShow("E07006",getErrorMessage("0","E07006",""),function(){var fName = new Array();$("input[type='checkbox'][name='fileNameCk']:checked").each(function(){fName.push($(this).val());})//E00008var files = new Array();for(var i = 0;i<fName.length;i++){files.push("ContentsDetail!download2.action?status=multi&" + "fileAttachFileName="+encodeURIComponent(fName[i])+"&contentsDto.contentsId="+$("#contentsId").val());}download_files(files);});}
0 0
- js模拟用户多次点击下载文件
- js模拟用户点击
- JS模拟超级链接下载文件
- JS实现点击按钮,下载文件
- 防止用户多次点击提交方法一:在js中的处理
- 模拟用户点击行为
- 模拟用户点击事件
- 防止用户多次点击按钮导致页面被多次提交
- Android中判断用户多次连续点击
- 点击提示用户下载文件并隐藏文件地址
- python 模拟鼠标点击自动下载文件然后输出文件名
- js模拟页面点击
- js模拟点击事件
- JS模拟点击-chrome
- JS 模拟鼠标点击
- JS模拟自动点击
- js 模拟点击事件
- js模拟点击事件
- C# string 对象 0008
- 枚举
- Apache poi操作doc,docx,xsl,xslx文件
- 数据库权限
- Websphere下删除某个文件(ibm-partialapp-delete.props)
- js模拟用户多次点击下载文件
- 15电气李丹【几位数乘一位数】【并保存到D盘】
- CreateThread()函数的简单程序
- 重建二叉树
- nodejs中exports与module.exports的区别
- Android源码解析之(十三)-->apk安装流程
- 机器学习课堂笔记(十二)
- 数据结构之物流信息的归并排序(非递归实现)
- 教你如何使用okhttp缓存