0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

10sec事にクリップボードにコピーするtextarea

Posted at

10sec事にクリップボードにコピーするtextarea
Javascript。
手動のボ夕ンでもcopy出来る。

注意

これをブラウザで開いている間は、 他でcopyしても10sec事にこのtextareaの内容で上書きされるので注意
autocopy.html
<html>
<HEAD>
	<title> AUTO COPY</title>
</HEAD>

<body>

<button id="bbb">手動コピー</button>&nbsp;<font color="#CCC">Rev.C58-20225i</font><br/>
<textarea id="myText" rows="24" cols="50"></textarea>

</body>
<SCRIPT language="JavaScript">

function copyText()
{
  var textArea = document.getElementById("myText");
  textArea.select();
  document.execCommand("copy");
  textArea.setSelectionRange(999, 999);
}

//--- void main(...)
document.getElementById("bbb").addEventListener("click", copyText);

 setInterval(() => 
	 {	console.log("Interval type3");  
		copyText();
	 }, 10000); //10sec

</SCRIPT>

</html>
0
0
2

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?