{"id":1428,"date":"2024-11-10T17:42:31","date_gmt":"2024-11-10T09:42:31","guid":{"rendered":"https:\/\/fwq.ai\/blog\/1428\/"},"modified":"2024-11-10T17:42:31","modified_gmt":"2024-11-10T09:42:31","slug":"javascript%e8%b7%b3%e8%bd%ac%e9%a1%b5%e9%9d%a2%e5%a4%b1%e8%b4%a5%ef%bc%8c%e5%a6%82%e4%bd%95%e8%a7%a3%e5%86%b3return%e8%af%ad%e5%8f%a5%e5%af%bc%e8%87%b4%e7%9a%84%e9%97%ae%e9%a2%98%ef%bc%9f","status":"publish","type":"post","link":"https:\/\/fwq.ai\/blog\/1428\/","title":{"rendered":"JavaScript\u8df3\u8f6c\u9875\u9762\u5931\u8d25\uff0c\u5982\u4f55\u89e3\u51b3return\u8bed\u53e5\u5bfc\u81f4\u7684\u95ee\u9898\uff1f"},"content":{"rendered":"<p><img decoding=\"async\" src=\"https:\/\/img.php.cn\/upload\/article\/001\/246\/273\/173043108341489.jpg\" class=\"aligncenter\" title=\"JavaScript\u8df3\u8f6c\u9875\u9762\u5931\u8d25\uff0c\u5982\u4f55\u89e3\u51b3return\u8bed\u53e5\u5bfc\u81f4\u7684\u95ee\u9898\uff1f\u63d2\u56fe\" alt=\"JavaScript\u8df3\u8f6c\u9875\u9762\u5931\u8d25\uff0c\u5982\u4f55\u89e3\u51b3return\u8bed\u53e5\u5bfc\u81f4\u7684\u95ee\u9898\uff1f\u63d2\u56fe\" \/><\/p>\n<p><strong>javascript\u8df3\u8f6c\u9875\u9762\u5931\u8d25\u539f\u56e0\u5206\u6790<\/strong><\/p>\n<p>\u5728\u7f16\u5199javascript\u4ee3\u7801\u65f6\uff0c\u9047\u5230\u8df3\u8f6c\u9875\u9762\u5931\u8d25\u7684\u95ee\u9898\u3002\u4ee3\u7801\u5982\u4e0b\uff1a<\/p>\n<pre>$('#confirm').on('click', function() {\n    var pre_code = $(\"#pre_code\").val();\n    if (pre_code != \"\") {\n        if (!isnum(pre_code)) {\n            alert(pre_code + \"\u8bf7\u586b\u51996\u4f4d\u6570\u5b57\");\n            $(\"#pre_code\").focus();\n        } else if (pre_code.length != 6) {\n            alert(pre_code + \"\u9884\u5b58\u7f16\u7801\u4e3a6\u4f4d\u6570\u5b57\");\n            $(\"#pre_code\").focus();\n        }\n        return;\n    } else {\n        alert(pre_code + \"\u8bf7\u586b\u51996\u4f4d\u6570\u5b57\u9884\u5b58\u7f16\u7801\");\n        $(\"#pre_code\").focus();\n        return;\n    }\n    $(\"#userform\").attr(\"action\", \"&lt;%=path%&gt; \/preinfo\/updatepre.&lt;do&gt;\");\n    $(\"#userform\").submit();\n});<\/pre>\n<p> \u767b\u5f55\u540e\u590d\u5236 <\/p>\n<p>\u7ecf\u8fc7\u5206\u6790\uff0c\u5bfc\u81f4\u9875\u9762\u8df3\u8f6c\u5931\u8d25\u7684\u539f\u56e0\u662f\u4ee3\u7801\u4e2d\u7b2c\u4e00\u4e2areturn\u8bed\u53e5\u3002\u5f53pre_code\u4e0d\u4e3a\u7a7a\u5b57\u7b26\u4e32\u65f6\uff0c\u4e0d\u8bba\u5176\u662f\u5426\u662f\u6570\u5b57\u62166\u4f4d\u6570\u5b57\uff0c\u90fd\u4f1a\u7acb\u5373\u8fd4\u56de\uff0c\u4e0d\u518d\u6267\u884c\u540e\u9762\u7684\u4ee3\u7801\u3002\u56e0\u6b64\uff0c$(&#8220;#userform&#8221;).submit();\u8bed\u53e5\u65e0\u6cd5\u6267\u884c\uff0c\u5bfc\u81f4\u9875\u9762\u8df3\u8f6c\u5931\u8d25\u3002<\/p>\n<p><strong>\u89e3\u51b3\u65b9\u6848<\/strong><\/p>\n<p><span>\u7acb\u5373\u5b66\u4e60<\/span>\u201c\u201d\uff1b<\/p>\n<p>\u5c06\u4ee3\u7801\u4e2d\u7684\u7b2c\u4e00\u4e2areturn\u8bed\u53e5\u5220\u9664\u6216\u4fee\u6539\u4e3acontinue;\u5373\u53ef\u89e3\u51b3\u95ee\u9898\u3002\u4fee\u6539\u540e\u7684\u4ee3\u7801\u5982\u4e0b\uff1a<\/p>\n<pre>$('#confirm').on('click', function() {\n    var pre_code = $(\"#pre_code\").val();\n    if (pre_code != \"\") {\n        if (!isNum(pre_code)) {\n            alert(pre_code + \"\u8bf7\u586b\u51996\u4f4d\u6570\u5b57\");\n            $(\"#pre_code\").focus();\n        } else if (pre_code.length != 6) {\n            alert(pre_code + \"\u9884\u5b58\u7f16\u7801\u4e3a6\u4f4d\u6570\u5b57\");\n            $(\"#pre_code\").focus();\n        }\n        continue;\n    } else {\n        alert(pre_code + \"\u8bf7\u586b\u51996\u4f4d\u6570\u5b57\u9884\u5b58\u7f16\u7801\");\n        $(\"#pre_code\").focus();\n        return;\n    }\n    $(\"#userForm\").attr(\"action\", \"&lt;%=path%&gt; \/preInfo\/updatePre.&lt;do&gt;\");\n    $(\"#userForm\").submit();\n});<\/pre>\n<p> \u767b\u5f55\u540e\u590d\u5236 <\/p>\n<p>\u4ee5\u4e0a\u5c31\u662fJavaScript\u8df3\u8f6c\u9875\u9762\u5931\u8d25\uff0c\u5982\u4f55\u89e3\u51b3return\u8bed\u53e5\u5bfc\u81f4\u7684\u95ee\u9898\uff1f\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>javascript\u8df3\u8f6c\u9875\u9762\u5931\u8d25\u539f\u56e0\u5206\u6790 \u5728\u7f16\u5199javascript\u4ee3\u7801\u65f6\uff0c\u9047\u5230\u8df3\u8f6c\u9875\u9762\u5931\u8d25\u7684\u95ee\u9898\u3002\u4ee3\u7801\u5982\u4e0b\uff1a $(&#8216;#confirm&#8217;).on(&#8216;click&#8217;, function() { var pre_code = $(&#8220;#pre_code&#8221;).val(); if (pre_code != &#8220;&#8221;) { if (!isnum(pre_code)) { alert(pre_code + &#8220;\u8bf7\u586b\u51996\u4f4d\u6570\u5b57&#8221;); $(&#8220;#pre_code&#8221;).focus(); } else if (pre_code.length != 6) { alert(pre_code + &#8220;\u9884\u5b58\u7f16\u7801\u4e3a6\u4f4d\u6570\u5b57&#8221;); $(&#8220;#pre_code&#8221;).focus(); } return; } else { alert(pre_code + &#8220;\u8bf7\u586b\u51996\u4f4d\u6570\u5b57\u9884\u5b58\u7f16\u7801&#8221;); $(&#8220;#pre_code&#8221;).focus(); return; } $(&#8220;#userform&#8221;).attr(&#8220;action&#8221;, &#8220;&lt;%=path%&gt; \/preinfo\/updatepre.&lt;do&gt;&#8221;); $(&#8220;#userform&#8221;).submit(); }); \u767b\u5f55\u540e\u590d\u5236 \u7ecf\u8fc7\u5206\u6790\uff0c\u5bfc\u81f4\u9875\u9762\u8df3\u8f6c\u5931\u8d25\u7684\u539f\u56e0\u662f\u4ee3\u7801\u4e2d\u7b2c\u4e00\u4e2areturn\u8bed\u53e5\u3002\u5f53pre_code\u4e0d\u4e3a\u7a7a\u5b57\u7b26\u4e32\u65f6\uff0c\u4e0d\u8bba\u5176\u662f\u5426\u662f\u6570\u5b57\u62166\u4f4d\u6570\u5b57\uff0c\u90fd\u4f1a\u7acb\u5373\u8fd4\u56de\uff0c\u4e0d\u518d\u6267\u884c\u540e\u9762\u7684\u4ee3\u7801\u3002\u56e0\u6b64\uff0c$(&#8220;#userform&#8221;).submit();\u8bed\u53e5\u65e0\u6cd5\u6267\u884c\uff0c\u5bfc\u81f4\u9875\u9762\u8df3\u8f6c\u5931\u8d25\u3002 \u89e3\u51b3\u65b9\u6848 \u7acb\u5373\u5b66\u4e60\u201c\u201d\uff1b \u5c06\u4ee3\u7801\u4e2d\u7684\u7b2c\u4e00\u4e2areturn\u8bed\u53e5\u5220\u9664\u6216\u4fee\u6539\u4e3acontinue;\u5373\u53ef\u89e3\u51b3\u95ee\u9898\u3002\u4fee\u6539\u540e\u7684\u4ee3\u7801\u5982\u4e0b\uff1a $(&#8216;#confirm&#8217;).on(&#8216;click&#8217;, function() [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[16],"tags":[],"class_list":["post-1428","post","type-post","status-publish","format-standard","hentry","category-16"],"_links":{"self":[{"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/posts\/1428","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=1428"}],"version-history":[{"count":0,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/posts\/1428\/revisions"}],"wp:attachment":[{"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/media?parent=1428"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/categories?post=1428"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/tags?post=1428"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}