2010-09-15 94 views
1

document.execCommand粘貼不起作用,即它只在選擇完成後才起作用,它會替換所選內容,否則不會進行任何更改。順便說一下,我正在使用一個contenteditable div元素,我試圖做到這一點。document.exec命令粘貼在contentEditable div中不工作

在所有瀏覽器中都失敗了,我在點擊ul的某個特定li元素時使用它。

<ul> 
    <li> 
     <a href="javascript:void(0)"onclick="paste();"><span>Paste</span></a> 
    </li> 
</ul> 

貼在哪裏是我使用的功能:document.execCommand('paste',false,null);

+0

[document.execCommand paste not working]的可能重複(http://stackoverflow.com/questions/3717204/document-execcommand-paste-not-working) – 2010-09-15 12:09:10

+0

需要更多信息。哪些瀏覽器會失敗?你如何觸發命令(例如,你是否使用按鈕?) – 2010-09-15 12:10:43

+0

它在所有瀏覽器中都失敗了,我在單擊某個ul的特定li元素時使用它。 (代碼)

其中糊料是其中是使用功能:document.execCommand( '粘貼',假,NULL); – Chinmaya 2010-09-15 12:24:14

回答

相關問題