javascript - Html 和 JavaScript : how to switch download link to button

标签 javascript html

我的页面上有一个导出到 Excel 的链接,例如:

<a download="queryResults.csv" href="#" onclick="return ExcellentExport.csv(this, 'datatable');">Export to CSV</a>

我想将其呈现为一个按钮,我尝试过类似的操作:

<button download="queryResults.csv" href="#" onclick="return ExcellentExport.csv(this, 'datatable');">Export to CSV</button>

我应该让它工作吗?谢谢。

最佳答案

 <a download="queryResults.csv"  
   onclick="return ExcellentExport.csv(this, 'datatable');" href="#"> 
   <button>Export to CSV</button>
 </a>

关于javascript - Html 和 JavaScript : how to switch download link to button,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/34245194/

相关文章:

javascript - 使用 setTimeout 延迟我的脚本

javascript - jsp表达式和java脚本一起

javascript - 利用 HTML5 中的前景和背景 Canvas

javascript - 将 View 外的 div 移入 View 中

javascript - 单击不同图像时播放不同的歌曲

html - ember-bootstrap : page background rendered half gray, 的问题通常应该是全白的

javascript - 3 秒后停止 JavaScript 函数

javascript - Highlight.js 在 Haskell 上失败了?

HTML 页脚未在两个表格下方对齐

html - Active 和 navbutton 有奇怪的 Bootstrap 填充