Js copy compatible with chrome and IE

  • 2020-03-30 02:31:07
  • OfStack

IE js code:
<script type="text/javascript"> 
function copyUrl2() 
var Url2=document.getElementById("biao1"); 
Url2.select(); //Select the object
document.execCommand("Copy"); //Execute the browser copy command
alert(" It has been copied and can be pasted. "); 
<textarea cols="20" rows="10" id="biao1"> User-defined code areas </textarea> 
<input type="button" onClick="copyUrl2()" value=" I'm gonna hit copy code " /> 

Chrome JS code:
<script src="http://www.weicaiyun.com/assets/js/copy/ZeroClipboard.js"></script> 

<script type="text/javascript"> 

var clip = new ZeroClipboard.Client(); 
clip.setHandCursor( true ); 
clip.setText(' Duplicate content '); 


<input type="button" id="button" value=" I'm gonna hit copy code " /> 

Related articles: