It can only match the integer, excluding decimal points, letters, Chinese characters, etc.
Used to verify QQ.
Problem complementary: I also receive the decimal point and receive it ... trouble change the change
Test the bridge on the sun, 123456.7 still passed
Function Checknum (TheForm) {
If (theform.qq.value.search (/^[0-9] {5,9} $/)! = -1) {
Return true;
}
else {
Alert (Please enter the QQ number correctly!);
Return false;
}
}
The right is as follows:
<script type = Text/JavaScript>
Function Checknum (TheForm) {
if (!/^/d {5,9} $/. Test (theForm.qq.value)) {
Alert (Please enter the QQ number correctly!);
Return false;
}
Return true;
}
</script>
<FORM ACTION = METHOD = get onSubmit = Return Checknum (this)> QQ: <input name = QQ Type = Text /> <input name = Type = submit value = Submission>
</form>