示例<!doctype html><html> <body> <p>type text below!</p> country: <input type = "text" name = "myid" id = "myid" onblur = "display()"> <script> function display() { var str = document.getelementbyid("myid"); str.value = str.value.touppercase(); } </script> </body></html>
以上就是当html元素失去焦点时执行脚本?的详细内容。
