The code is as follows:
/***************************************************************************************
*validate1.0
*The copyright of this code belongs to Ocean Studio Ocean. You can use, copy, and modify this code for non-commercial purposes, but you need to
*Retain copyright information of this studio. If you use or modify this code for commercial purposes, please contact this studio for use permission.
*
*If you have any suggestions for this program, please email: [email protected].
*
*Ocean Studio
*http://www.oceanstudio.net
*Ocean([email protected])
*********************************************************************************************
//Keyboard event
<PUBLIC:ATTACHEVENT="onkeypress"ONEVENT="doEvent()"/>
//Paste event
<PUBLIC:ATTACHEVENT="onpaste"ONEVENT="doEvent()"/>
// Lost focus event
<PUBLIC:ATTACHEVENT="onblur"ONEVENT="doEvent()"/>
<SCRIPTLANGUAGE="JScript">
//Predefined check mode
varregArray=newArray(
newArray("int+0","^//d+$",""," Need to enter a non-negative integer, please recheck"), // Non-negative integer (positive integer +0)
newArray("int+","^[0-9]*[1-9][0-9]*$","^//d+$","You need to enter a positive integer, please recheck"), //Positive integer
newArray("int-0","^((-//d+)|(0+))$","^(-|(-//d+)|(0+))$"," Need to enter a non-positive integer, please recheck"), // Non-positive integer (negative integer + 0)