<table class="table_std">
    <tr>
        <th scope="row">会员ID</th>
        <td>
            <input type="text" name="comId" size="30" οnkeyup="value=value.replace(/[^\w+\uFF10-\uFF19]+/g,'')" value="<s:property value="comId" />" class="inp" id="comId"/>
            <span class="small"></span>
            <input type="hidden" name="userAgent" id="userAgent"/>
        </td>
    </tr>
    <tr class="gray">
        <th scope="row">登录ID</th>
        <td>
            <input id="loginId" type="text" name="login" size="30" class="inp"  value="<s:property value="loginName" />" />
            <span class="small"></span>
        </td>
    </tr>
    <tr>
                        <th scope="row">日期</th>
                        <td><s:textfield key="condition.openStartDtm" size="10"
                            cssClass="inp" maxlength="10" id="admission_from" />  </td>
                    </tr>

                    <tr class="gray">
                        <th scope="row">显示件数</th>
                        <td><s:textfield key="condition.pageNumber" size="5" id="pageNumber" 
                            maxlength="3" cssClass="inp" /> &nbsp;件<span class="small">
                        例)100</span> <s:fielderror fieldName="condition.pageNumber" /></td>
                    </tr>
                    <tr>
                        <th scope="row">研修ID</th>
                        <td><s:textfield key="condition.id" size="25" maxlength="10" id="condition_id"
                            cssClass="inp" /> <span class="small"> 例)CCC000001(完全一致)</span>
                        <s:fielderror fieldName="condition.id" /></td>
                    </tr>
</table>

<script type="text/javascript">
$(function(){
    //显示件数,只能输入半角数字,全角数字
    $("#pageNumber").bind('input propertychange', function() {  
    	$(this).val($(this).val().replace(/[^0-9+^\uFF10-\uFF19]+/g,''));
    });
    
    //日期只能输入全角,半角数字和'/'
    $("#admission_from").bind('input propertychange',function(){
    	$(this).val($(this).val().replace(/[^0-9+\/+^\uFF10-\uFF19]+/g,''));
    });
    
    //登录ID 只能输入半角英文,全角半角数字
    $('#loginId').bind('input propertychange', function() {  
		$(this).val($(this).val().replace(/[^\w+\uFF10-\uFF19]+/g,''));
	}); 
    $("#condition_id").bind('input propertychange',function(){
    	$(this).val($(this).val().replace(/[^\w+\uFF10-\uFF19+\uFF41-\uFF5A+\uFF21-\uFF3A]+/g,''));
    });
}
</script>

使用JS限制input输入框只允许中文汉字、数字、整数等效果,多款代码如下:

判断日文的正则表达式

1. GBK (GB2312/GB18030)

\x00-\xff  GBK双字节编码范围

\x20-\x7f  ASCII

\xa1-\xff  中文

\x80-\xff  中文

2. UTF-8 (Unicode)

\u4e00-\u9fa5 (中文)

\x3130-\x318F (韩文

\xAC00-\xD7A3 (韩文)

\u0800-\u4e00 (日文)

ps: 韩文是大于[\u9fa5]的字符

参考:http://www.cnblogs.com/dongzhiquan/archive/2009/09/13/1994736.html


其一,只允许输入数字和小数点。 

<input onKeypress="return (/[\d.]/.test(String.fromCharCode(event.keyCode)))" style="ime-mode:Disabled">