<html>
<meta http-equiv="content-type" charset="utf-8">
	<head>
		<title>連番出力</title>
		<link rel="icon" href="/favicon.ico">
	</head>
	<body>
		<input type="text" id="St-Val" onkeyup="ReView();" value="0"  > 開始<br>
		<input type="text" id="Ed-Val" onkeyup="ReView();" value="300"> 終了<br>
		<input type="text" id="Sp-Val" onkeyup="ReView();" value="1"  > 飛び数<br>
		<button onclick="copyToClipBoard();">↓ Copy</button><br>
		<span id="View-DATA"></span>
		<script language="JavaScript">

			// 最初の実行
			document.addEventListener('DOMContentLoaded', function(){ DOMContentLoaded_Exec(); } , false )
			function DOMContentLoaded_Exec() {
				ReView() // 再表示
				document.getElementById('Ed-Val').focus();
				document.getElementById('Ed-Val').select();
			}

			// 再表示
			function ReView(){
				let Str = "";
				let WrkSt = GetTxtBox2Num( "St-Val" );
				let WrkEd = GetTxtBox2Num( "Ed-Val" ) + 1;
				let WrkSp = GetTxtBox2Num( "Sp-Val" );

				let WrkZs = String(WrkEd-1).length;
				let WrkZc = Array(WrkZs+1).join("0");
				if( WrkSp < 1 ){ // 無限ループ回避
					WrkSp=1;
				}

				// 一覧生成
				WrkZs = WrkZs * -1;
				for(let i = WrkSt; i < WrkEd; i+=WrkSp) {
					Str += ( WrkZc + i ).slice( WrkZs ) + "<br>";
				}

				// 表示
				document.getElementById("View-DATA").innerHTML = Str;

			}

			// ElementIdから数字に変換
			function GetTxtBox2Num( WrkElementId ){
				let WrkStr = document.getElementById( WrkElementId ).value; 
				WrkStr = WrkStr.replace(/,/g,''); // カンマ消す
				return Number( WrkStr ); // 数字に変換
			}

			function copyToClipBoard() {
				navigator.clipboard.writeText(document.getElementById("View-DATA").innerText);
			}

		</script>
	</body>
</html>
<< 広告 >>