{"id":357,"date":"2017-07-06T11:33:53","date_gmt":"2017-07-06T03:33:53","guid":{"rendered":"http:\/\/luchanglong.com.cn\/?p=357"},"modified":"2017-07-11T14:17:42","modified_gmt":"2017-07-11T06:17:42","slug":"javascript-%e6%8e%a7%e5%88%b6input%e5%8f%aa%e5%85%81%e8%ae%b8%e8%be%93%e5%85%a5%e7%9a%84%e5%90%84%e7%a7%8d%e6%8c%87%e5%ae%9a%e5%86%85%e5%ae%b9","status":"publish","type":"post","link":"https:\/\/blog.la998.com\/?p=357","title":{"rendered":"javascript \u63a7\u5236input\u53ea\u5141\u8bb8\u8f93\u5165\u7684\u5404\u79cd\u6307\u5b9a\u5185\u5bb9"},"content":{"rendered":"<p>\u53ea\u5141\u8bb8\u8f93\u5165\u6570\u5b57<\/p>\n<div class=\"line number1 index0 alt2\"><code class=\"xhtml plain\">&lt;<\/code><code class=\"xhtml keyword\">input<\/code> <code class=\"xhtml color1\">name<\/code><code class=\"xhtml plain\">=<\/code><code class=\"xhtml string\">\"username\"<\/code> <code class=\"xhtml color1\">type<\/code><code class=\"xhtml plain\">=<\/code><code class=\"xhtml string\">\"text\"\u00a0<\/code><code class=\"xhtml color1\">onkeyup<\/code><code class=\"xhtml plain\">=<\/code><code class=\"xhtml string\">\"value=this.value.replace(\/\\D+\/g,'')\"<\/code><code class=\"xhtml plain\">&gt;<\/code><\/div>\n<div class=\"line number2 index1 alt1\">\u53ea\u5141\u8bb8\u8f93\u5165\u82f1\u6587\u5b57\u6bcd\u3001\u6570\u5b57\u548c\u4e0b\u5212\u7ebf(\u4ee5\u4e0b\u4e8c\u79cd\u65b9\u6cd5\u5b9e\u73b0)<\/div>\n<div class=\"line number2 index1 alt1\">\n<div class=\"line number1 index0 alt2\"><code class=\"xhtml plain\">&lt;<\/code><code class=\"xhtml keyword\">input<\/code><code class=\"xhtml color1\">name<\/code><code class=\"xhtml plain\">=<\/code><code class=\"xhtml string\">\"username\"<\/code><code class=\"xhtml color1\">type<\/code><code class=\"xhtml plain\">=<\/code><code class=\"xhtml string\">\"text\"\u00a0<\/code><code class=\"xhtml color1\">style<\/code><code class=\"xhtml plain\">=<\/code><code class=\"xhtml string\">\"ime-mode:disabled\"<\/code><code class=\"xhtml plain\">&gt;<\/code><\/div>\n<div class=\"line number3 index2 alt2\"><code class=\"xhtml plain\">&lt;<\/code><code class=\"xhtml keyword\">input<\/code><code class=\"xhtml color1\">name<\/code><code class=\"xhtml plain\">=<\/code><code class=\"xhtml string\">\"username\"<\/code><code class=\"xhtml color1\">type<\/code><code class=\"xhtml plain\">=<\/code><code class=\"xhtml string\">\"text\"\u00a0<\/code><code class=\"xhtml color1\">onkeyup<\/code><code class=\"xhtml plain\">=<\/code><code class=\"xhtml string\">\"value=value.replace(\/[^\\w\\.\\\/]\/ig,'')\"<\/code><code class=\"xhtml plain\">&gt;<\/code><\/div>\n<\/div>\n<div class=\"line number3 index2 alt2\">\u53ea\u5141\u8bb8\u8f93\u5165\u82f1\u6587\u5b57\u6bcd\u3001\u6570\u5b57\u548c=@#<\/div>\n<div class=\"line number3 index2 alt2\">\n<div class=\"line number1 index0 alt2\"><code class=\"xhtml plain\">&lt;<\/code><code class=\"xhtml keyword\">input<\/code><code class=\"xhtml color1\">name<\/code><code class=\"xhtml plain\">=<\/code><code class=\"xhtml string\">\"username\"<\/code><code class=\"xhtml color1\">type<\/code><code class=\"xhtml plain\">=<\/code><code class=\"xhtml string\">\"text\"\u00a0<\/code><code class=\"xhtml color1\">onkeyup<\/code><code class=\"xhtml plain\">=<\/code><code class=\"xhtml string\">\"value=value.replace(\/[^\\w=@#]|_\/ig,'')\"<\/code><code class=\"xhtml plain\">&gt;<\/code><\/div>\n<div class=\"line number1 index0 alt2\">\u53ea\u5141\u8bb8\u8f93\u5165\u6c49\u5b57<\/div>\n<div class=\"line number1 index0 alt2\"><code class=\"xhtml plain\">&lt;<\/code><code class=\"xhtml keyword\">input<\/code><code class=\"xhtml color1\">name<\/code><code class=\"xhtml plain\">=<\/code><code class=\"xhtml string\">\"username\"<\/code><code class=\"xhtml color1\">type<\/code><code class=\"xhtml plain\">=<\/code><code class=\"xhtml string\">\"text\"<\/code><code class=\"xhtml color1\">onkeyup<\/code><code class=\"xhtml plain\">=<\/code><code class=\"xhtml string\">\"value=value.replace(\/[^\\u4E00-\\u9FA5]\/g,'')\"<\/code><code class=\"xhtml plain\">&gt;<\/code><\/div>\n<\/div>\n<div class=\"line number1 index0 alt2\"><\/div>\n<div class=\"line number1 index0 alt2\"><\/div>\n<div class=\"line number1 index0 alt2\">\u00a0\u9a8c\u8bc1\u4e2d\u6587\u59d3\u540d\uff08\u5305\u62ec\u5982\uff1a\u8d3e\u683c\u601d\u00b7\u6bd4\u4f2f \u7b49\uff09\uff1a<\/div>\n<div class=\"line number1 index0 alt2\">\n<pre class=\"\">\u6b63\u5219\uff1a\/^[\\u4E00-\\u9FA5\u00b7s]{2,6}$\/<\/pre>\n<pre class=\"\">var chk = \/^[\\u4E00-\\u9FA5\u00b7s]{2,6}$\/;\r\nif(!chk.test(name)){\r\nalert(\"\u6b63\u786e\");\r\n}<\/pre>\n<\/div>\n","protected":false},"excerpt":{"rendered":"<p>\u53ea\u5141\u8bb8\u8f93\u5165\u6570\u5b57 &lt;input name=&#8221;username&#8221; type=&#8221;text&#8221;\u00a0onkeyup=&#8221; &hellip; <a href=\"https:\/\/blog.la998.com\/?p=357\" class=\"more-link\">\u7ee7\u7eed\u9605\u8bfb<span class=\"screen-reader-text\">javascript \u63a7\u5236input\u53ea\u5141\u8bb8\u8f93\u5165\u7684\u5404\u79cd\u6307\u5b9a\u5185\u5bb9<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[15],"tags":[],"class_list":["post-357","post","type-post","status-publish","format-standard","hentry","category-javascrit"],"_links":{"self":[{"href":"https:\/\/blog.la998.com\/index.php?rest_route=\/wp\/v2\/posts\/357","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/blog.la998.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/blog.la998.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/blog.la998.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/blog.la998.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=357"}],"version-history":[{"count":3,"href":"https:\/\/blog.la998.com\/index.php?rest_route=\/wp\/v2\/posts\/357\/revisions"}],"predecessor-version":[{"id":363,"href":"https:\/\/blog.la998.com\/index.php?rest_route=\/wp\/v2\/posts\/357\/revisions\/363"}],"wp:attachment":[{"href":"https:\/\/blog.la998.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=357"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/blog.la998.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=357"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/blog.la998.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=357"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}