JavaScript Tutorial copy specified content save to clipboard code
HTML code
<input type= "text" id= "Testinput" name= "Testinput" value= "4234324234"/>
<div id= "Buttonbox" >
<button onclick= "Copy (' Testinput ')" >copy</button>
</div> Flash Code
On (release) {
Import Flash.external.externalinterface;
var inputtext = externalinterface.call (' flashcopy ');
System.setclipboard (Inputtext);
Externalinterface.call (' Flashcopyback ');
_root.bobotext.text = Inputtext;
JS Code
<script>
Function $ (ID) {
return document.getElementById (ID);
}
Function copy () {//ie6
var value = $ (' testinput '). Value;
Window.clipboarddata.cleardata ();
Window.clipboarddata.setdata ("text", value);
Alert (' Copy succeeded! ');
}
Function Flashcopy () {//firefox .....
Return $ (' Testinput '). Value;
}
Function Flashcopyback () {
alert (' Copy succeeded! ');
}
if ("V"!= "V") {//If not IE, copy
$ (' Buttonbox ') in flash. innerHTML = ' <embed src= ' 111.swf ' width= ' 48 ' height= "quality=" High "pluginspage=" Http://www.macromedia.com/go/getflashplayer "type=" application/ X-shockwave-flash "></embed>";
}
</script>
if (window.xmlhttprequest) {//If not IE, copy
$ (' Buttonbox ') in flash. innerHTML = ' <embed src= ' flashcopy.swf ' Width= "" "
height=" quality= "High"
pluginspage= "http://www.macromedia.com/go/getflashplayer"
type= " Application/x-shockwave-flash "></embed>";
}