2013-11-24 43 views
0

這裏正常工作是我的代碼:不能得到document.execCommand與複製文本

function createTextArea() { 
    var t = document.createElement("textArea"); 
    textArea = document.body.appendChild(t); 

    return textArea; 
} 

function copy(str) { 
    var textArea = createTextArea(); 
    textArea.value = str; 
    textArea.select(); 
    document.execCommand("Copy"); 
} 

copy("hello") 

現在,當我嘗試粘貼,我放到textarea的文本沒有出現。有誰知道我做錯了什麼?

回答