运行 ❯
获取您
的
网站
×
更改方向
保存代码
更改主题,深色/浅色
前往 Spaces
<!DOCTYPE html> <html> <head> <script> function myFunction() { const x = document.getElementById("fname"); x.value = x.value.toUpperCase(); } </script> </head> <body> <h1>JavaScript HTML Events</h1> <h2>The onblur Attribute</h2> Enter your name: <input type="text" id="fname" onblur="myFunction()"> <p>When you leave the input field, a function is triggered which transforms the input text to upper case.</p> </body> </html>