<body> <script language= "JavaScript "> function check(str) { var pattern = /^[a-z\d\u4E00-\u9FA5]+$/i; if (pattern.test(str)) alert( "输入正确:只包含中文、字母、数字 "); else alert( "错误:含有符号 ") } </script> <input type = "text" id = "txt" value = ""> <input type = "button" onclick = "check(txt.value)" value = "Check"> </body>