简体   繁体   English

当我们使用 javascript 或 jQuery 或 bootstrap 单击下载按钮时如何创建可下载的 zip 文件

[英]How to create a downloadable zip file when we click on download button using javascript or jQuery or bootstrap

In my site i have requirement where we have couple of accordian titles.when a accrdian is expanded it should show a list of documents without download option and the document should have option of "add to" button..when we click the add to button/check box the document should be selected and the count should show beside the title of accordian..and we have one more download button at the bottom of all accordians..that final download section should show total count of all the selected documents from all the individual accordians and when we click on the download button the selected document/document s should be download as zip file.在我的网站上,我要求我们有几个手风琴标题。当展开手风琴时,它应该显示没有下载选项的文档列表,并且文档应该有“添加到”按钮选项。当我们单击添加到按钮时/check box 文档应该被选中并且计数应该显示在 accordian 的标题旁边..我们在所有 accordians 的底部还有一个下载按钮..最终的下载部分应该显示所有选定文档的总数个别手风琴,当我们单击下载按钮时,所选文档/文档应下载为 zip 文件。 And when no documents are selected the count should be zero and download button should be inactive...also in the accrdian for some documents there is requirement of deafault selection..can anyone please help me on this当没有选择任何文件时,计数应该为零并且下载按钮应该处于非活动状态......在某些文件的accrdian中也有默认选择的要求......任何人都可以帮助我解决这个问题

I am facing lot of issues while trying and I'm new to javascript.我在尝试时遇到了很多问题,而且我是 javascript 的新手。

When you create a link to a zip file like shown below the browser should automatically download it, maybe that helps you.当您创建指向如下所示的 zip 文件的链接时,浏览器应该会自动下载它,也许这对您有帮助。

<a target='_blank' href='/downloads/archive.zip'>Click here to download something!</a>

(By adding the target='_blank' the link will be opened a new tab) (通过添加target='_blank'链接将打开一个新选项卡)

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 Javascript或JQuery:单击radiobutton - Javascript or JQuery: click a radiobutton 如何在Java中使用Selenium单击此输入文件的浏览按钮? - How to click on the browse button of this inputfile using selenium in JAVA? 如何预选<select>使用 jQuery 在 Bootstrap 中列出项目 - How to preselect a <select> list item in Bootstrap using jQuery 在使用RateIt for jQuery时,将“重置”按钮替换为普通的星形 - Replacing the 'reset' button with a normal star when using RateIt for jQuery 使用 jQuery 需要相互依赖的按钮 CHANGE 和 select CLICK 功能。 我需要将它们组合在准备好的文件上吗? - Need interdependent button CHANGE and select CLICK functionality by using jQuery. I need to combine them on document ready? 在链接点击时使用jQuery / JavaScript更改下拉选项 - Change dropdown option with jQuery/Javascript on link click 使用再次选择时如何使用引导程序3激活模式窗口? - how to activate modal window using bootstrap 3 when use select again? 如何使用不带按钮和JavaScript的选择框来加载数据库内容 - How to load database content using Select box without button & javaScript 我们如何使用量角器工具中的javascript从日期选择器中选择日期? 您能提出解决方案吗? - How we select date from date picker using javascript in protractor tool? can you suggest solutions? 如何使用 jQuery / JavaScript 从下拉列表中删除所有选项 - How to remove all options from a dropdown using jQuery / JavaScript
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM