if (window.clipboardData){
//var content = document.body.innerHTML;
var printTable = document.getElementById("printTable");
var therange=document.body.createTextRange();
therange.moveToElementText(printTable);
therange.select();
therange.execCommand("Copy");
alert('复制成功!');
}
ie11中报错:
SCRIPT606: 由于出现错误 800a025e 而导致此项操作无法完成。
怎么解决?
1.重置ie;
2.更换不同核心的浏览器测试;
3.F12,开发者模式设置ie版本以及文档模式测试;
4.去掉保护模式的勾,重启ie测试;
5.可能ie版本过高导致无法打开
将 ie 设置模式下: 改为兼容模式,,,,
,'newwindow','status=1,scrollbars
=1,resizable=1'); window.opener = null;window.open('', '_self'); window.close(); 这
therange.select();
改为:try{
therange.select();
}catch(ex){}
就可以了
ie内核版本不同引起的吧
浏览器复制,不依赖flash ,兼容所有浏览器,无依赖,
https://github.com/zenorocha/clipboard.js
加个therange.blur();试试