实例代码“Ctrl+/”提示“F11/ESC”全屏 返回 格式化 恢复 运行
x
 
1
<!DOCTYPE html>
2
<html>
3
<head>
4
<script>
5
function myFunction()
6
{
7
var x=document.getElementById("fname");
8
x.value=x.value.toUpperCase();
9
}
10
</script>
11
</head>
12
<body>
13
14
<p>A function is triggered when the user releases a key in the input field. The function transforms the character to upper case.</p>
15
Enter your name: <input type="text" id="fname" onkeyup="myFunction()">
16
17
</body>
18
</html>