14:<!-- 参照サイト
15:https://www.marorika.com/entry/copy-to-clipboard
16:https://teratail.com/questions/222919
17:-->
18:</head>
19:<body>
20:<h1>アクセス先の名称です</h1>
21:<h2>サービス名</h2>
22:<p><a href="https://www.・・・・・・・・/" target="_blank" id="・・・・">ログインページ</a> </p>
23:<table style="border:none">
24:<thead>
25:<tr>
26:<th>項番</th>
27:<th>入力項目</th>
28:<th>値</th>
29:</tr>
30:</thead>
31:<tbody>
32:<tr>
33:<td>1</td>
34:<td>入力項目1</td>
35:<td><input id="copyTarget1" type="text" value="入力項目1値" readonly>
36:<button onclick="copyToClipboard(1)">コピー</button>
37:</td>
38:</tr>
39:<tr>
40:<td>2</td>
41:<td>入力項目2</td>
42:<td><input id="copyTarget2" type="text" value="入力項目2値" readonly>
43:<button onclick="copyToClipboard(2)">コピー</button>
44:</td>
45:</tr>
46:<tr>
47:<td>3</td>
48:<td>入力項目3</td>
49:<td><input id="copyTarget3" type="text" value="入力項目3値" readonly>
50:<button onclick="copyToClipboard(3)">コピー</button>
51:</td>
52:</tr>
53:</tbody>
54:</table>
55:</body>
56:</html>
03:<html>
04:<head>
05:<title>WEBページ名称</title>
06:<script>
07:function copyToClipboard(index) {
08:var copyTarget = document.getElementById("copyTarget" + index);
09:copyTarget.select();
10:document.execCommand("Copy");
11:alert("Copied: " + copyTarget.value);
12:}
13:</script>
最近あるページでログインする際に、いくつかの値を逐次入力するのが面倒と感じて、入力値を記載したHTMLファイル(入力値を誤って変更することがないようにHTMLファイルで値を管理)を準備し、ボタン操作で入力値をクリップボードに転送できないものかと考えた。
作成にあたり、下記2サイトを参照させて頂いた。
以下、自家用としてのサンプル。
ソースコードは別ページに続く。
「彼女と2人で行った温泉旅行。夕食で焼酎を注文したら、宿のオヤジの態度が急変し...」(東京都・40代男性)
勝手に英訳
There are many things to look forward to on a trip, but dinner at the inn is one of them.
Drinking sake with delicious local food as a side dish. It is truly a blissful moment.
However, depending on where you travel, the choice of which sake to drink may have a very important meaning.
Mr. L, a J-Town Net reader in his 40s, had just such an experience in Kagoshima Prefecture about 20 years ago.
About 20 years ago, I stayed at Ibusuki hot spring in Kagoshima Prefecture with my girlfriend.
When we had dinner at the inn, I ordered a beer, and the old man who took our order had a casual attitude like, "Oh, beer (hmm)," but when I ordered shochu for the second glass, he changed his mind.
The old man suddenly smiled and said, "When you come to Kagoshima, you want to drink shochu, don't you!" He then poured shochu into my glass one after another.
When I asked for a third glass of shochu, he said, "As much as you like," and poured a bottle! He also brought some sashimi of Kibinago, a Kagoshima specialty, saying, "It goes well with shochu." I said, "No, I didn't order that," but he said, "I want you to have a good memory of Kagoshima by drinking good sake with good snacks," and brought me more Satsuma Jidori chicken sashimi. In the end, we had a big party with the old man and other guests until past midnight.
When we checked out the next day, the bill indicated "Beer: 800 yen, Shochu: 100 yen." "Is there a mistake?" I asked, but the old man said, "In Kagoshima, shochu is water."
The girl I went with at that time is now my wife, and after almost 20 years, we still talk about how much we want to go back to Kagoshima. Translated with www.DeepL.com/Translator (free version)