`

Validate number only input

阅读更多
        var returnValue = true;
        var zip_code = $('#edit-zipcode').attr('value');
        if(zip_code.length > 5) {
            returnValue = false;
            $('#edit-zipcode').addClass('error');
        }else if(zip_code.length >0){
			for(var i=0; i<zip_code.length; i++) {
				var key = zip_code.charAt(i);
				if(((key < "0")||(key > "9"))&&!(key == "")) {
	                returnValue = false;
	                $('#edit-zipcode').addClass('error');
	                break;
				}
			}
        }
        return returnValue;
分享到:
评论

相关推荐

    jquery.validate

    digits: "Please enter only digits." } }); ``` ##### 9. 信用卡号验证:`creditcard` 验证输入的值是否符合常见的信用卡号格式。 ```javascript $("#form").validate({ rules: { creditcard: { creditcard: ...

    jquery.validate使用攻略

    - **number**: 验证是否为合法的数字。 - **digits**: 验证是否为整数。 - **creditcard**: 验证是否为合法的信用卡号。 - **equalTo**: 验证字段的值是否与另一个字段相等。 - **accept**: 验证是否为有效的文件...

    jquery.validate验证快速上手

    - **digits**: "Please enter only digits." - **equalTo**: "Please enter the same value again." - **minlength**: "Please enter at least {0} characters." #### 三、jQuery Validate 使用方法 **1. 将验证...

    jQuery 表单验证插件formValidation实现个性化错误提示

    8. `onlyNumber`:只允许输入数字。 9. `noSpecialCharacters`:不允许特殊字符。 10. `onlyLetter`:仅限字母。 11. `date`:验证日期格式(YYYY-MM-DD)。 formValidation的使用示例包括验证不同类型的表单元素:...

    JAVA编写的图书馆管理系统

    ProgressMonitorInputStream in=new ProgressMonitorInputStream(this,"读取help文件",input); ProgressMonitor p=in.getProgressMonitor(); while(in.read(b)!=-1){ String s=new String(b...

    wget-1.11.4-1

    --no-check-certificate don't validate the server's certificate. --certificate=FILE client certificate file. --certificate-type=TYPE client certificate type, PEM or DER. --private-key=FILE private ...

    数位板压力测试

    The interface provides access to one or more devices that produce pointing input. Devices sup¬ported by this interface have some common characteristics. The device must define an absolute or relative...

    王小平版遗传算法的光盘源代码

    contains functions to evaluate and validate populations and trees, early termination, and definition of the fitness (training and test) cases. As a second example, for your enlightenment, we ...

    Google C++ Style Guide(Google C++编程规范)高清PDF

    place new input-only parameters before the output parameters. This is not a hard-and-fast rule. Parameters that are both input and output (often classes/structs) muddy the waters, and, as always, ...

    acpi控制笔记本风扇转速

    GPEs, to be used for debugging systems with a large number of ACPI interrupts. Implemented support for the "DMAR" ACPI table (DMA Redirection Table) in both the ACPICA headers and the disassembler. ...

    flash标签云 3D效果 PHP插件 by weefselkweekje

    Optionally, you can use the second input box to specify a different color. When two colors are available, each tag's color will be from a gradient between the two. This allows you to create a multi-...

    VB编程资源大全(英文源码 网络)

    &lt;END&gt;&lt;br&gt;12 , telnet.zip Telnet Application&lt;END&gt;&lt;br&gt;13 , validip.zip Validate an IP address 14 , dmvbtest.zip This is a complete email sending client in Visual Basic&lt;END&gt;&lt;br&gt;15 , ...

    Delphi7.1 Update

    This modification reduces the number of index keywords, but does not affect other Help system functionality, such as cross-file linking or F1 accessibility. ==========================================...

Global site tag (gtag.js) - Google Analytics