在javascript中复制到剪贴板功能?

时间:2015-03-25 12:33:47

标签: javascript

我有复制到剪贴板的按钮功能,点击按钮,页面自动刷新。但是,我不希望使用Internet Explorer刷新页面,可以使用

 event.preventDefault ? event.preventDefault() : event.returnValue = false;

此代码在IE中正常运行。在Firefox和Chrome中是否有类似的方式?

1 个答案:

答案 0 :(得分:0)

对于按钮,

  <button class="SmallBtn" type="button" onclick="Print()" id="BatchDetailPrintBtn">Print</button>

jquery看起来像

 function Print() {
window.print();
} 

这对我来说非常适合。