给一个不好的建议:把数字(0-9),字母(A-Z,a-z)及标点符号去掉。去看看别人是如何做的吧,很多什么免费申请表单中都能找到这方面的例子。

解决方案 »

  1.   

    给一个很差的建议:在客户端的textbox的onchange事件中将非中文字符去掉
      

  2.   

    中文的ACSII大于128
    但我不知道怎么写这个JS(以前是在下一页检验后显示的不适合的,但头儿说不方便)
    :(
      

  3.   

    搞定 看源碼<!------------ 看看字符的unicode碼,就可以找到辦法 ------------>
    <html><head>
    <meta http-equiv="Content-Type" content="text/html; charset=big5">
    <meta name="GENERATOR" content="Microsoft FrontPage 4.0">
    <meta name="ProgId" content="FrontPage.Editor.Document">
    <title>新網頁1</title>
    </head><body>
    <input name="T1" typt="text" value="I am a 中國人 , Are you 喜歡 ?" onblur="checktext()" style="width:300;border:1 solid blue">
    </body>
    <script language="javascript">
    function checktext()
    {
    strS = document.all.T1.value;
    if(checkchinese(strS) == false) alert(escape(strS));
    }function checkchinese(strS)
    {
    strS = escape(strS);
    var i=0 ; 
    while(i<strS.length)
    {
    if(strS.charAt(i)=="%")
    {
    if(strS.charAt(i+1)=="u")
    {
    i = i + 6;
    }else{
    i = i + 3;
    }
    }else{
    return(false);
    }
    }
    if(i <= strS.length-1) return(true);
    }
    </script>
    </html>
      

  4.   

    <html>
    <head>
    <title> New Document </title>
    <script>
    function checkinput(obj)
    {
    if(event.keyCode<0xA0){
    event.cancelBubble=true;
    event.returnValue=false;
    }
    }
    </script>
    </head><body>
    <input type=text onkeypress="checkinput(this)">
    </body>
    </html>
      

  5.   

    <html>
    <head>
    <title> New Document </title>
    <script>
    function checkinput()
    {
    if(event.keyCode<0xA0){
    event.cancelBubble=true;
    event.returnValue=false;
    }
    }
    </script>
    </head><body>
    <input type=text onkeypress="checkinput()">
    </body>
    </html>