{"id":31150,"date":"2024-11-25T17:58:07","date_gmt":"2024-11-25T09:58:07","guid":{"rendered":"https:\/\/fwq.ai\/blog\/31150\/"},"modified":"2024-11-25T17:58:07","modified_gmt":"2024-11-25T09:58:07","slug":"jquery%e5%ae%9e%e7%8e%b0%e6%89%80%e6%9c%89%e9%aa%8c%e8%af%81%e9%80%9a%e8%bf%87%e6%96%b9%e5%8f%af%e6%8f%90%e4%ba%a4%e7%9a%84%e8%a1%a8%e5%8d%95%e5%ae%9e%e4%be%8b%e8%ae%b2%e8%a7%a3","status":"publish","type":"post","link":"https:\/\/fwq.ai\/blog\/31150\/","title":{"rendered":"jQuery\u5b9e\u73b0\u6240\u6709\u9a8c\u8bc1\u901a\u8fc7\u65b9\u53ef\u63d0\u4ea4\u7684\u8868\u5355\u5b9e\u4f8b\u8bb2\u89e3"},"content":{"rendered":"<p>\u672c\u6587\u4e3b\u8981\u4e3a\u5927\u5bb6\u8be6\u7ec6\u4ecb\u7ecd\u4e86jquery\u5b9e\u73b0\u8868\u5355\u9a8c\u8bc1\uff0c\u6240\u6709\u9a8c\u8bc1\u901a\u8fc7\u65b9\u53ef\u63d0\u4ea4\uff0c\u5177\u6709\u4e00\u5b9a\u7684\u53c2\u8003\u4ef7\u503c\uff0c\u611f\u5174\u8da3\u7684\u5c0f\u4f19\u4f34\u4eec\u53ef\u4ee5\u53c2\u8003\u4e00\u4e0b\uff0c\u5e0c\u671b\u80fd\u5e2e\u52a9\u5230\u5927\u5bb6\u3002<\/p>\n<pre>\r\n&nbsp;\r\n&nbsp;&nbsp;&lt;meta&gt;\r\n&nbsp;&nbsp;&lt;title&gt;Reg&lt;\/title&gt;\r\n&nbsp;&nbsp;&lt;style&gt;\r\n   .state1{\r\n    color:#aaa;\r\n   }\r\n   .state2{\r\n    color:#000;\r\n   }\r\n   .state3{\r\n    color:red;\r\n   }\r\n   .state4{\r\n    color:green;\r\n   }\r\n  &lt;\/style&gt;\r\n&nbsp;&nbsp;&lt;script&gt;&lt;\/script&gt;\r\n&nbsp;&nbsp;&lt;script&gt;\r\n   $(function(){\r\n \r\n    var ok1=false;\r\n    var ok2=false;\r\n    var ok3=false;\r\n    var ok4=false;\r\n    \/\/ \u9a8c\u8bc1\u7528\u6237\u540d\r\n    $(&#039;input[name=\"username\"]&#039;).focus(function(){\r\n     $(this).next().text(&#039;\u7528\u6237\u540d\u5e94\u8be5\u4e3a3-20\u4f4d\u4e4b\u95f4&#039;).removeClass(&#039;state1&#039;).addClass(&#039;state2&#039;);\r\n    }).blur(function(){\r\n     if($(this).val().length &gt;= 3 &amp;&amp; $(this).val().length &lt;=12 &amp;&amp; $(this).val()!=&#039;&#039;){\r\n      $(this).next().text(&#039;\u8f93\u5165\u6210\u529f&#039;).removeClass(&#039;state1&#039;).addClass(&#039;state4&#039;);\r\n      ok1=true;\r\n     }else{\r\n      $(this).next().text(&#039;\u7528\u6237\u540d\u5e94\u8be5\u4e3a3-20\u4f4d\u4e4b\u95f4&#039;).removeClass(&#039;state1&#039;).addClass(&#039;state3&#039;);\r\n     }\r\n      \r\n    });\r\n \r\n    \/\/\u9a8c\u8bc1\u5bc6\u7801\r\n    $(&#039;input[name=\"password\"]&#039;).focus(function(){\r\n     $(this).next().text(&#039;\u5bc6\u7801\u5e94\u8be5\u4e3a6-20\u4f4d\u4e4b\u95f4&#039;).removeClass(&#039;state1&#039;).addClass(&#039;state2&#039;);\r\n    }).blur(function(){\r\n     if($(this).val().length &gt;= 6 &amp;&amp; $(this).val().length &lt;=20 &amp;&amp; $(this).val()!=&#039;&#039;){\r\n      $(this).next().text(&#039;\u8f93\u5165\u6210\u529f&#039;).removeClass(&#039;state1&#039;).addClass(&#039;state4&#039;);\r\n      ok2=true;\r\n     }else{\r\n      $(this).next().text(&#039;\u5bc6\u7801\u5e94\u8be5\u4e3a6-20\u4f4d\u4e4b\u95f4&#039;).removeClass(&#039;state1&#039;).addClass(&#039;state3&#039;);\r\n     }\r\n      \r\n    });\r\n \r\n    \/\/\u9a8c\u8bc1\u786e\u8ba4\u5bc6\u7801\r\n     $(&#039;input[name=\"repass\"]&#039;).focus(function(){\r\n     $(this).next().text(&#039;\u8f93\u5165\u7684\u786e\u8ba4\u5bc6\u7801\u8981\u548c\u4e0a\u9762\u7684\u5bc6\u7801\u4e00\u81f4,\u89c4\u5219\u4e5f\u8981\u76f8\u540c&#039;).removeClass(&#039;state1&#039;).addClass(&#039;state2&#039;);\r\n    }).blur(function(){\r\n     if($(this).val().length &gt;= 6 &amp;&amp; $(this).val().length &lt;=20 &amp;&amp; $(this).val()!=&#039;&#039; &amp;&amp; $(this).val() == $(&#039;input[name=\"password\"]&#039;).val()){\r\n      $(this).next().text(&#039;\u8f93\u5165\u6210\u529f&#039;).removeClass(&#039;state1&#039;).addClass(&#039;state4&#039;);\r\n      ok3=true;\r\n     }else{\r\n      $(this).next().text(&#039;\u8f93\u5165\u7684\u786e\u8ba4\u5bc6\u7801\u8981\u548c\u4e0a\u9762\u7684\u5bc6\u7801\u4e00\u81f4,\u89c4\u5219\u4e5f\u8981\u76f8\u540c&#039;).removeClass(&#039;state1&#039;).addClass(&#039;state3&#039;);\r\n     }\r\n      \r\n    });\r\n \r\n    \/\/\u9a8c\u8bc1\u90ae\u7bb1\r\n    $(&#039;input[name=\"email\"]&#039;).focus(function(){\r\n     $(this).next().text(&#039;\u8bf7\u8f93\u5165\u6b63\u786e\u7684EMAIL\u683c\u5f0f&#039;).removeClass(&#039;state1&#039;).addClass(&#039;state2&#039;);\r\n    }).blur(function(){\r\n     if($(this).val().search(\/w+([-+.]w+)*@w+([-.]w+)*.w+([-.]w+)*\/)==-1){\r\n      $(this).next().text(&#039;\u8bf7\u8f93\u5165\u6b63\u786e\u7684EMAIL\u683c\u5f0f&#039;).removeClass(&#039;state1&#039;).addClass(&#039;state3&#039;);\r\n     }else{     \r\n      $(this).next().text(&#039;\u8f93\u5165\u6210\u529f&#039;).removeClass(&#039;state1&#039;).addClass(&#039;state4&#039;);\r\n      ok4=true;\r\n     }\r\n      \r\n    });\r\n \r\n    \/\/\u63d0\u4ea4\u6309\u94ae,\u6240\u6709\u9a8c\u8bc1\u901a\u8fc7\u65b9\u53ef\u63d0\u4ea4\r\n \r\n    $(&#039;.submit&#039;).click(function(){\r\n     if(ok1 &amp;&amp; ok2 &amp;&amp; ok3 &amp;&amp; ok4){\r\n      $(&#039;form&#039;).submit();\r\n     }else{\r\n      return false;\r\n     }\r\n    });\r\n     \r\n   });\r\n  &lt;\/script&gt;\r\n&nbsp;\r\n\r\n&nbsp;\r\n<\/pre>\n<p> \u767b\u5f55\u540e\u590d\u5236 &nbsp;\u7528&nbsp;\u6237&nbsp;\u540d: &nbsp;&nbsp;&nbsp;&nbsp;<br \/>\n<span>\u8bf7\u8f93\u5165\u7528\u6237\u540d<\/span> <\/p>\n<p> &nbsp;\u5bc6\u3000\u3000\u7801: &nbsp;&nbsp;&nbsp;&nbsp;<br \/>\n<span>\u8bf7\u8f93\u5165\u5bc6\u7801<\/span> <\/p>\n<p> &nbsp;\u786e\u8ba4\u5bc6\u7801: &nbsp;&nbsp;&nbsp;&nbsp;<br \/>\n<span>\u8bf7\u8f93\u5165\u786e\u8ba4\u5bc6\u7801<\/span> <\/p>\n<p> &nbsp;\u90ae\u3000\u3000\u7bb1: &nbsp;&nbsp;&nbsp;&nbsp;<br \/>\n<span>\u8bf7\u8f93\u5165\u90ae\u7bb1<\/span> <\/p>\n<p>&nbsp; &nbsp;  <\/p>\n<p>\u76f8\u5173\u63a8\u8350\uff1a<\/p>\n<\/p>\n<\/p>\n<p>\u4ee5\u4e0a\u5c31\u662fjQuery\u5b9e\u73b0\u6240\u6709\u9a8c\u8bc1\u901a\u8fc7\u65b9\u53ef\u63d0\u4ea4\u7684\u8868\u5355\u5b9e\u4f8b\u8bb2\u89e3\u7684\u8be6\u7ec6\u5185\u5bb9\uff0c\u66f4\u591a\u8bf7\u5173\u6ce8\u7c73\u4e91\u5176\u5b83\u76f8\u5173\u6587\u7ae0\uff01<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u672c\u6587\u4e3b\u8981\u4e3a\u5927\u5bb6\u8be6\u7ec6\u4ecb\u7ecd\u4e86jquery\u5b9e\u73b0\u8868\u5355\u9a8c\u8bc1\uff0c\u6240\u6709\u9a8c\u8bc1\u901a\u8fc7\u65b9\u53ef\u63d0\u4ea4\uff0c\u5177\u6709\u4e00\u5b9a\u7684\u53c2\u8003\u4ef7\u503c\uff0c\u611f\u5174\u8da3\u7684\u5c0f\u4f19\u4f34\u4eec\u53ef\u4ee5\u53c2\u8003\u4e00\u4e0b\uff0c\u5e0c\u671b\u80fd\u5e2e\u52a9\u5230\u5927\u5bb6\u3002 &nbsp; &nbsp;&nbsp;&lt;meta&gt; &nbsp;&nbsp;&lt;title&gt;Reg&lt;\/title&gt; &nbsp;&nbsp;&lt;style&gt; .state1{ color:#aaa; } .state2{ color:#000; } .state3{ color:red; } .state4{ color:green; } &lt;\/style&gt; &nbsp;&nbsp;&lt;script&gt;&lt;\/script&gt; &nbsp;&nbsp;&lt;script&gt; $(function(){ var ok1=false; var ok2=false; var ok3=false; var ok4=false; \/\/ \u9a8c\u8bc1\u7528\u6237\u540d $(&#039;input[name=&#8221;username&#8221;]&#039;).focus(function(){ $(this).next().text(&#039;\u7528\u6237\u540d\u5e94\u8be5\u4e3a3-20\u4f4d\u4e4b\u95f4&#039;).removeClass(&#039;state1&#039;).addClass(&#039;state2&#039;); }).blur(function(){ if($(this).val().length &gt;= 3 &amp;&amp; $(this).val().length &lt;=12 &amp;&amp; $(this).val()!=&#039;&#039;){ $(this).next().text(&#039;\u8f93\u5165\u6210\u529f&#039;).removeClass(&#039;state1&#039;).addClass(&#039;state4&#039;); ok1=true; }else{ $(this).next().text(&#039;\u7528\u6237\u540d\u5e94\u8be5\u4e3a3-20\u4f4d\u4e4b\u95f4&#039;).removeClass(&#039;state1&#039;).addClass(&#039;state3&#039;); } }); \/\/\u9a8c\u8bc1\u5bc6\u7801 $(&#039;input[name=&#8221;password&#8221;]&#039;).focus(function(){ $(this).next().text(&#039;\u5bc6\u7801\u5e94\u8be5\u4e3a6-20\u4f4d\u4e4b\u95f4&#039;).removeClass(&#039;state1&#039;).addClass(&#039;state2&#039;); }).blur(function(){ if($(this).val().length &gt;= 6 [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[19],"tags":[],"class_list":["post-31150","post","type-post","status-publish","format-standard","hentry","category-19"],"_links":{"self":[{"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/posts\/31150","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/comments?post=31150"}],"version-history":[{"count":0,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/posts\/31150\/revisions"}],"wp:attachment":[{"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/media?parent=31150"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/categories?post=31150"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/tags?post=31150"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}