要求:
-
用户名必须是3-10位英文字母或数字;
-
口令必须是6-20位;
-
两次输入口令必须一致。
<!DOCTYPE html> <html> <head> <meta charset="utf-8" /> <title>js实现注册表单验证</title> </head> <body> <form id="test-register" action="#" target="#" onsubmit="return checkRegisterForm()"> <p id="test-error" style="color:red"></p> <p> 用户名: <input type="text" id="username" name="username"> </p> <p> 密码: <input type="password" id="password" name="password"> </p> <p> 确认密码: <input type="password" id="password2"> </p> <p> <button type="submit">提交</button&g