怎样使用?
1.先下载这个FLASH文件: 下载,右键另存
2..代码如下:
<html>
<head>
<title>用flash+javscript实现网页上的文本复制</title>
</head>
<body>
<script type="text/javascript" language="javascript">
function copyit(textit) {
if (window.clipboardData) {
window.clipboardData.setData("Text",textit);//IE下能够运行
} else {
var flashcopier = 'flashcopier';
if(!document.getElementById(flashcopier)) {
var divholder = document.createElement('div');
divholder.id = flashcopier;
document.body.appendChild(divholder);
}
document.getElementById(flashcopier).innerHTML = '';
var divinfo = '<embed src="_clipboard.swf" FlashVars="clipboard='+textit+'" width="0" height="0" type="application/x-shockwave-flash"></embed>';
document.getElementById(flashcopier).innerHTML = divinfo;
}
}
//copyit("")
</script>
<input type="text" value="用flash+javscript实现网页上的文本复制" id="g">
<a href="javascript:copyit(document.getElementById('g').value);">复制一下</a>
</body>
</html>
1.先下载这个FLASH文件: 下载,右键另存
2..代码如下:
<html>
<head>
<title>用flash+javscript实现网页上的文本复制</title>
</head>
<body>
<script type="text/javascript" language="javascript">
function copyit(textit) {
if (window.clipboardData) {
window.clipboardData.setData("Text",textit);//IE下能够运行
} else {
var flashcopier = 'flashcopier';
if(!document.getElementById(flashcopier)) {
var divholder = document.createElement('div');
divholder.id = flashcopier;
document.body.appendChild(divholder);
}
document.getElementById(flashcopier).innerHTML = '';
var divinfo = '<embed src="_clipboard.swf" FlashVars="clipboard='+textit+'" width="0" height="0" type="application/x-shockwave-flash"></embed>';
document.getElementById(flashcopier).innerHTML = divinfo;
}
}
//copyit("")
</script>
<input type="text" value="用flash+javscript实现网页上的文本复制" id="g">
<a href="javascript:copyit(document.getElementById('g').value);">复制一下</a>
</body>
</html>