copy-content
by sunny_zhang
HTML
<p id="copy_text">我是要复制的内容</p>
<button onclick="copyContent('copy_text')">copy</button><br /><br />
<input type="text" placeholder="粘贴检验" />
JavaScript
function copyContent(eleId){
var temp = document.createElement("input");
temp.setAttribute("value",document.getElementById(eleId).innerHTML);
document.body.appendChild(temp)
temp.select()
document.execCommand("copy")
document.body.removeChild(temp)
}