Home > Web Front-end > JS Tutorial > js copies web page content and is compatible with the code of major browsers_javascript skills

js copies web page content and is compatible with the code of major browsers_javascript skills

WBOY
Release: 2016-05-16 17:08:51
Original
1384 people have browsed it

Because we need to make a js click to copy the function of the current web page URL. The following method is used, but it can only be used normally under the IE browser.

The method is as follows:

Copy code The code is as follows:

function copyURL( ){
var clipBoardContent="";
clipBoardContent =document.title;
clipBoardContent ="";
clipBoardContent =this.location.href;
window.clipboardData.setData("Text ",clipBoardContent);
alert("Copied successfully, please paste it into your QQ/MSN and recommend it to your friends");
}

------ ------------------Divider---------------------------

Find a flash on the Internet
zClip

zClip
zClip plug-in is compatible with various browsers.

The method of use is very simple, you only need to import a js file and a swf file.

The usage method is as follows

You need to import the required files first:
Copy the code The code is as follows :




$(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 also some configuration methods, see the official website for details: http://www.steamdev.com/zclip/
Plug-in download address
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template