怎么复制里面的内容,而不是代码。在视图模式下复制之后直接去其他编辑器或word区域粘贴就出来样式了,这个复制其中内容这步该怎么做。我打算在页面下面加个button,单击后就可以 复制内容到剪切板。

解决方案 »

  1.   

    试试下面的代码:
    <script>
    //复制到剪贴板
    function{
    var oEditor = FCKeditorAPI.GetInstance("editor");
     document.getElementById("test").value=oEditor.EditorDocument.body.innerText; 
    textRange = document.getElementById("test").createTextRange(); 
    textRange.execCommand("Copy"); 
     document.getElementById("test").value="";
    }
    //恢复数据
    function huifu() { 
    textRange = document.getElementById("hui").createTextRange(); 
    textRange.execCommand("Paste"); 
     var oEditor = FCKeditorAPI.GetInstance("editor") ; 
        oEditor.SetHTML(document.getElementById("hui").value) ;
        document.getElementById("hui").value=""; 
       

    //清空数据
    function cler(){
     var oEditor = FCKeditorAPI.GetInstance("editor") ; 
    oEditor.SetHTML("") ;
    }
    </script>     <input id="Button2" type="button" name="abc" onclick="huifu()"  value="恢复数据"/>&nbsp;
         <input id="Button3" type="button" name="abc" onclick="cler()"  value="清空数据"/>
      

  2.   

    这里有你要的答案 http://www.olcodes.com/article/html/5210.html