-1

Below is what I have come up with So far:

<input type="text" id="Copymachine" onclick="select_all(this)" class="text-center form-control" placeholder="username:password">

I have a button. I can select the text I want from the page, but can not figure out how to now, copy to clip board and paste from clipboard to "New Text Document (3)" a .txt file on my desktop. In other words I want to be able to click the text thats generate and in one click, highlight it and paste it into a .txt on the desktop.

I was going to add the Java tag. I am unfamiliar with web coding.

King96
  • 47
  • 2
  • 14
  • For security reasons, this is not possible with JavaScript. However, there is a work around for this using `ActiveXObject`, but this limited to IE –  Nov 16 '16 at 05:39
  • You can [copy to clipboard](http://stackoverflow.com/questions/400212/how-do-i-copy-to-the-clipboard-in-javascript), but writing to external doc is not allowed – Rajesh Nov 16 '16 at 05:40
  • Just noticed I forgot to mention the button. – King96 Nov 16 '16 at 05:47

1 Answers1

-1

You can use this javascript snippet:

<input onClick="this.select();" value="Sample Text" />

But apparently it doesn't work on mobile Safari. In those cases you can use:

<input onClick="this.setSelectionRange(0, this.value.length)" value="Sample Text" />
Vishal Gupta
  • 819
  • 5
  • 23
  • The question says "I can select the text I want from the page" — The code you've provided does the one thing they don't need help with. – Quentin Nov 16 '16 at 23:33