<html>
<body>
<p>当用户在输入字段中释放按键时会触发函数。该函数将字符转换为大写。</p>
请输入您的姓名:<input type="text" id="fname" onkeyup="myFunction()">
<script>
function myFunction() {
var x = document.getElementById("fname");
x.value = x.value.toUpperCase();
}
</script>
</body>
</html>