{"id":2684,"date":"2023-11-14T14:26:31","date_gmt":"2023-11-14T06:26:31","guid":{"rendered":""},"modified":"2023-11-14T14:26:31","modified_gmt":"2023-11-14T06:26:31","slug":"JavaScript\u8868\u5355\u9a8c\u8bc1","status":"publish","type":"post","link":"https:\/\/bianchenghao6.com\/2684.html","title":{"rendered":"JavaScript\u8868\u5355\u9a8c\u8bc1"},"content":{"rendered":"
\n

JavaScript\u8868\u5355\u9a8c\u8bc1<\/h1>\n<\/div>\n
\n \u9a8c\u8bc1\u7528\u6237\u63d0\u4ea4\u7684\u8868\u5355\u5f88\u91cd\u8981\uff0c\u56e0\u4e3a\u5b83\u7684\u503c\u53ef\u80fd\u4e0d\u5408\u9002\u3002\u56e0\u6b64\uff0c\u5fc5\u987b\u901a\u8fc7\u9a8c\u8bc1\u6765\u9a8c\u8bc1\u7528\u6237\u8eab\u4efd\u3002\n<\/div>\n
\n JavaScript\u63d0\u4f9b\u4e86\u5728\u5ba2\u6237\u7aef\u9a8c\u8bc1\u8868\u5355\u7684\u529f\u80fd\uff0c\u56e0\u6b64\u6570\u636e\u5904\u7406\u5c06\u6bd4\u670d\u52a1\u5668\u7aef\u9a8c\u8bc1\u66f4\u5feb\u3002\u5927\u591a\u6570Web\u5f00\u53d1\u4eba\u5458\u66f4\u559c\u6b22JavaScript\u8868\u5355\u9a8c\u8bc1\u3002\n<\/div>\n
\n \u901a\u8fc7JavaScript\uff0c\u6211\u4eec\u53ef\u4ee5\u9a8c\u8bc1\u540d\u79f0\uff0c\u5bc6\u7801\uff0c\u7535\u5b50\u90ae\u4ef6\uff0c\u65e5\u671f\uff0c\u624b\u673a\u53f7\u7801\u548c\u66f4\u591a\u5b57\u6bb5\u3002\n<\/div>\n

JavaScript\u8868\u5355\u9a8c\u8bc1\u793a\u4f8b<\/h2>\n
\n \u5728\u6b64\u793a\u4f8b\u4e2d\uff0c\u6211\u4eec\u5c06\u9a8c\u8bc1\u540d\u79f0\u548c\u5bc6\u7801\u3002\u540d\u79f0\u4e0d\u80fd\u4e3a\u7a7a\uff0c\u5bc6\u7801\u4e0d\u80fd\u5c11\u4e8e6\u4e2a\u5b57\u7b26\u3002\n<\/div>\n
\n \u5728\u8fd9\u91cc\uff0c\u6211\u4eec\u6b63\u5728\u9a8c\u8bc1\u8868\u5355\u63d0\u4ea4\u65f6\u7684\u8868\u5355\u3002\u5728\u7ed9\u5b9a\u503c\u6b63\u786e\u4e4b\u524d\uff0c\u4e0d\u4f1a\u5c06\u7528\u6237\u8f6c\u53d1\u5230\u4e0b\u4e00\u9875\u3002\n<\/div>\n
\n
 <script>
function validateform(){
var name=document.myform.name.value;
var password=document.myform.password.value;
if (name==null || name==\"\"){
  alert(\"Name can't be blank\");
  return false;
}else if(password.length<6){
  alert(\"Password must be at least 6 characters long.\");
  return false;
  }
}
<\/script>
<body>
<form name=\"myform\" method=\"post\" action=\"abc.jsp\" onsubmit=\"return validateform<\/span>()\" >
Name: <input type=\"text\" name=\"name\"><br\/>
Password: <input type=\"password\" name=\"password\"><br\/>
<input type=\"submit\" value=\"register\">
<\/form>
<\/span><\/code><\/pre>\n<\/div>\n
\n \u8f93\u51fa\uff1a\n<\/div>\n
\n