Js copies web content and is compatible with the code of the major browsers

  • 2020-03-30 00:58:48
  • OfStack

Because of the need to do a js click, copy the current web url function. The following method is used, but it can only be used in Internet explorer.

Here's how:
 
function copyURL(){ 
var clipBoardContent=""; 
clipBoardContent+=document.title; 
clipBoardContent+=""; 
clipBoardContent+=this.location.href; 
window.clipboardData.setData("Text",clipBoardContent); 
alert(" Copy successful, please paste into yours QQ/MSN Recommend it to your friends "); 
} 

-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- separation line -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --

Find a flash on the web
zClip

zClip
The zClip plug-in is compatible with a variety of browsers.

The method is simple to use, just import a js file and a SWF file.

Use as follows

To import the required documents:
 
<script type="text/javascript" src="js/jquery.js"></script> 
<script type="text/javascript" src="js/jquery.zclip.js"></script> 

$(document).ready(function(){ 
$('a#copy-description').zclip({ 
path:'js/ZeroClipboard.swf', 
copy:$('p#description').text() 
}); 

// The link with ID "copy-description" will copy 
// the text of the paragraph with ID "description" 

$('a#copy-dynamic').zclip({ 
path:'js/ZeroClipboard.swf', 
copy:function(){return $('input#dynamic').val();} 
}); 

// The link with ID "copy-dynamic" will copy the current value 
// of a dynamically changing input with the ID "dynamic" 

}); 

There are some configuration method, as shown in the website: http://www.steamdev.com/zclip/
(link: http://xiazai.jb51.net//201312/yuanma/zeroclipboard (jb51.net). Zip)

Related articles: