The first half of the sentence means that keyboard typing can only be numbers, and the second half of the sentence means that pasting can only be numbers
function isregname( checkobj) { var checkOK = "0123456789 -_abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ"; var checkStr = checkobj; var allValid = true; var decPoints = 0; for (i = 0; i < checkStr.length; i ) { ch = checkStr.charAt(i); for (j = 0; j < checkOK.length; j ) if (ch == checkOK.charAt(j)) break; if (j == checkOK.length) { allValid = false; break; } } return (allValid) } ---------------- if(!(isregname(obj.loginname.value))){ alert("[Member code] does not comply with the specification, member code It can only be English letters or numbers"); obj.loginname.focus(); return(false); } if(!(isregname(obj.password.value))) { alert("[Password] does not meet the specifications, the password can only be English letters or numbers"); obj.password.focus(); return(false); }
4.javascript can only input English and numbers into the input box
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn