JS+flash实现chrome和ie浏览器下同时可以复制粘贴
时间:2021-05-17 08:40:19|栏目:JavaScript代码|点击: 次
利用2个文件
ZeroClipboard.js
ZeroClipboard.swf
<script type="text/javascript" src="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 onload="init(1);">
ZeroClipboard.js
ZeroClipboard.swf
复制代码 代码如下:
<script type="text/javascript" src="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 onload="init(1);">
栏 目:JavaScript代码
下一篇:JavaScript常用正则验证函数实例小结【年龄,数字,Email,手机,URL,日期等】
本文标题:JS+flash实现chrome和ie浏览器下同时可以复制粘贴
本文地址:http://www.codeinn.net/misctech/123093.html






