Note that the code is reproduced z :( operation only the editable area)
< Script type = "text / JavaScript" > function copyUrl2 () { var Url2 = document.getElementById ( " biao1 " ) .innerText; var oInput = document.createElement ( ' INPUT ' ); oInput.value = Url2; the document.body .appendChild (oInput); oInput.select (); // select the object document.execCommand ( " copy " ); // execute browser copy command oInput.className= ' OInput ' ; oInput.style.display = ' none ' ;oInput
.setSelectionRange(0, 9999);
Alert ( ' successfully copied ' ); } </ Script > < div cols = "20 is" ID = "biao1" > 12345678 </ div > < INPUT type = "the Button" onClick = "copyUrl2 ()" value = "click copy Code" />
Reproduced in: https: //www.cnblogs.com/xiaozhumaopao/p/11047428.html