网页添加复制表格
页面里客户要求添加个复制按钮,我在网上找了段代码放在页面里,<SCRIPT LANGUAGE="JavaScript" type="text/JavaScript">
<!--
function CopyTable()
{
CopyHtmlElement(oTable)
}
function CopyHtmlElement(obj)
{
editor.document.designMode = 'On'; // 将iframe变成可编辑模式,即HTML编辑器
editor.document.write("<body></body>"); // 初始化编辑器
editor.document.body.innerHTML = obj.outerHTML;
editor.document.body.createTextRange().select(); // 选中编辑器内所有内容
editor.document.execCommand("copy","",null); // 复制
}
function PastClipboardData()
{
editor.focus();
editor.document.execCommand("paste","",null); // 粘贴
}
//-->
但是显示editor未定义,不知道怎么回事。请问有没有其他的方法给解决?