JS+flash实现chrome和ie浏览器下同时可以复制粘贴

chrome和ie同时可以复制粘贴,想必大家一直思索的问题在本文将有一个不错的实现,下面为大家介绍下JS+flash是如何实现的,感兴趣的朋友可以参考下

利用2个文件

ZeroClipboard.js

ZeroClipboard.swf

复制代码 代码如下:


<script type="text/javascript" src="https://www.jb51.net/ZeroClipboard.js"></script>
<script language="JavaScript">

var clip = null;

function $(id) { return document.getElementById(id); }

function init(xm) {
clip = new ZeroClipboard.Client();
clip.setHandCursor( true );

clip.addEventListener('load', function (client) {
debugstr("Flash movie loaded and ready.");
});

clip.addEventListener('mouseOver', function (client) {
// update the text on mouse over
clip.setText($('txt_links').value );
});

clip.addEventListener('complete', function (client, text) {
debugstr(xm );
});

clip.glue( 'd_clip_button', 'd_clip_container' );
}

function debugstr(msg) {
if(msg=='1'){
alert('复制成功,请用Chrl+V粘贴');
//alert('chushihu,请用Chrl+V粘贴');
}else{

}

}
</script>


注意:<body>

您可能感兴趣的文章:

内容版权声明:除非注明,否则皆为本站原创文章。

转载注明出处:https://www.heiqu.com/wdzjzz.html