用flash实现的复制到剪切板,真正跨浏览器
as:
package { import flash.display.Sprite; import adobe.utils.CustomActions; import flash.display.*; import flash.events.*; import flash.text.StyleSheet; import flash.text.TextField; import flash.utils.Timer; import flash.external.ExternalInterface; import flash.system.System; public class Main extends Sprite { public function Main():void { stage.scaleMode = StageScaleMode.NO_SCALE; init(); } private function init():void { var txt:TextField = new TextField(); var css:StyleSheet = new StyleSheet(); css.parseCSS(".clipboard {fontSize:12px;color:#0000ff;}"); txt.styleSheet = css; txt.htmlText = "
复制到剪切板
"; txt.addEventListener(MouseEvent.CLICK, clickHandler); addChild(txt); } private function clickHandler(evt:Event):void { var content:String = ExternalInterface.call("getData")||" "; System.setClipboard(content); ExternalInterface.call("copySuccess"); } } }
html:
用flash实现的复制到剪切板,真正跨浏览器
用flash实现的复制到剪切板,真正跨浏览器
clipboard
您的浏览器不支持复制到剪切板,请使用ctrl+c