</pre><pre name="code" class="html"><span style="font-family: Arial, Helvetica, sans-serif;"><!DOCTYPE html></span> <html> <head> <meta charset="UTF-8"> <title>Insert title here</title> <script type="text/javascript"> function Show(text) { var len = text.length; if (len == 4) { alert(len); if (text == "cumt") { var show = document.getElementById("show"); show.innerHTML = text; } } } </script> </head> <body> 请输入: cumt <br> <br> <input οnkeyup="Show(this.value);"> <br> <div id="show"></div> </body> </html>