function CopyImage(img) {
    if (img.tagName != 'IMG')
        return;
    if (typeof img.contentEditable == 'undefined')
        return;
    if (!document.body.createControlRange)
        return;
    var ctrl = document.body.createControlRange();
    img.contentEditable = true;
    ctrl.addElement(img);
    ctrl.execCommand('Copy');
    img.contentEditable = false;
    alert('复制图片完成');
}

 

 

function CopyToClipBoard(){
    var clipBoardContent="abcdefg";
    window.clipboardData.setData("Text",clipBoardContent);
    alert('复制文字完成');
}

相关文章:

  • 2021-09-01
  • 2022-12-23
  • 2022-01-10
  • 2022-12-23
  • 2022-12-23
  • 2022-01-05
猜你喜欢
  • 2021-12-03
  • 2021-06-08
  • 2022-12-23
  • 2021-10-18
  • 2022-12-23
  • 2021-12-03
相关资源
相似解决方案