Time:09-18
CodePudding user response:
this is very simple, isn't it
& lt; html> <meta charset="utf-8" & gt; The function the save () {Var username=document. GetElementById (" username "). The value; Var password=document. GetElementById (" userpass "). The value; If (username=='| | username==null) {Alert (" the user name cannot be empty!" ); return; } If (password=='| | password==null) {Alert (" password cannot be empty!" ); return; } Var/reg=^ [a-z] (?=. * ([0-9])?=. * [a zA - Z]) ([a zA - Z0-9] {7, 15}) $/g; Var checkPass=reg. Test (password); If (checkPass) {Alert (" password consists of Numbers and letters, the beginning must be... "); return; } Document. Biaodan. Submit (); } </script> <body> User name: & lt; Input type="text" name="Ming" id="username"/& gt; Compact & amp; nbsp; & nbsp; & nbsp; Code: & lt; Input type="password" name="mi" id="userpass"/& gt;