- <html>
- <head>
- <meta http-equiv="Content-Type" content="text/html" />
- <title>只能输入汉字js脚本</title>
- </head>
- <body>
- 只能输入汉字:<INPUT onkeyup="value=value.replace(/[^u4E00-u9FA5]/g,'')">
- <script>
- function ischinese(s){
- var ret=true;
- for(var i=0;i<s.length;i++)
- retret=ret && (s.charCodeAt(i)>=10000);
- return ret;
- }
- </script>
- </body>
- </html>