当前位置:软件学习 > Flash >>

js+flash复制到剪贴板

 <script type="text/javascript">
    function copy_code(copyText)
    {
        if (window.clipboardData)
        {
            window.clipboardData.setData("Text", copyText)
        }
        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="../js/_clipboard.swf" FlashVars="clipboard='+encodeURIComponent(copyText)+'" width="0" height="0" type="application/x-shockwave-flash"></embed>';
            document.getElementById(flashcopier).innerHTML = divinfo;
        }
      alert('copy成功!');
    }
    </script>
   
    <input id="inputTest" type="button" value="测试" onclick="copy_code('拷贝成功!帆船书会http://www.zzzyk.com)"  />

flash文件下载地址:http://down.zzzyk.com/mbs/2011/10/07/_clipboard.rar

补充:flash教程,动画技术
CopyRight © 2022 站长资源库 编程知识问答 zzzyk.com All Rights Reserved
部分文章来自网络,