编辑下面的代码:【加编码】
<html> <head> <script> function displayResult() { var x=document.getElementById("fname"); x.value=x.value.toUpperCase(); } </script> </head> <body> <p>在输入域松开按键时触发函数。该函数将小写字母转为大写字母。</p> 输入你的名字: <input type="text" id="fname" onkeyup="displayResult()"> </body> </html>
结果: 【此窗口】 帮助?
Try it Yourself - © 自强学堂