<!DOCTYPE html>
<html>
<body>
<h2>JavaScript HTML イベント</h2>
あなたの名前を入力してください:<input type="text" id="fname" onchange="upperCase()">
<p>入力フィールドを離れると、入力テキストを大文字に変換する関数がトリガーされます。</p>
<script>
function upperCase() {
const x = document.getElementById("fname");
x.value = x.value.toUpperCase();
}
</script>
</body>
</html>