wagga2650 Posted November 27, 2009 Share Posted November 27, 2009 I have this javascript that when you press a button it oauto selects the data in the textarea and copies it so all you need to do is paste it back into another application. It works fine in IE but in other browsers it only highlights but not copies it to the clipboard, can someone take a look and advise where I have gone wrong please. here is the code <HEAD> <SCRIPT LANGUAGE="JavaScript"> <!-- Begin function copyit(theField) { var tempval=eval("document."+theField) tempval.focus() tempval.select() therange=tempval.createTextRange() therange.execCommand("Copy") } // End --> </script> </head> <BODY> <form name="it"> <div align="center"> <input onclick="copyit('it.select1')" type="button" value="Press to Copy the Text" name="cpy"> <p> <textarea name="select1" rows="3" cols="25"> If this is highlighted, then it has been copied. </textarea> </div> </form> <!-- Script Size: 1.21 KB --> </body> Link to comment https://forums.phpfreaks.com/topic/183160-browser-compatibility-for-my-script/ Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.