{"id":1936,"date":"2023-03-25T14:26:38","date_gmt":"2023-03-25T06:26:38","guid":{"rendered":""},"modified":"2023-03-25T14:26:38","modified_gmt":"2023-03-25T06:26:38","slug":"ES6 \u9a8c\u8bc1","status":"publish","type":"post","link":"https:\/\/bianchenghao6.com\/1936.html","title":{"rendered":"ES6 \u9a8c\u8bc1"},"content":{"rendered":"
\n
\u57fa\u672c\u9a8c\u8bc1- \u8fd9\u662f\u4e00\u4e2a\u786e\u4fdd\u6240\u6709\u5fc5\u586b\u5b57\u6bb5\u90fd\u5df2\u586b\u5199\u6216\u672a\u586b\u5199\u7684\u8fc7\u7a0b\u3002 <\/span> <\/code>\n <\/div>\n <\/code>\n <\/div>\n <\/body>
\n \u6570\u636e\u683c\u5f0f\u9a8c\u8bc1- \u987e\u540d\u601d\u4e49\uff0c\u5c31\u662f\u68c0\u67e5\u8f93\u5165\u7684\u6570\u636e\u662f\u5426\u6b63\u786e\u7684\u8fc7\u7a0b\u3002\u6211\u4eec\u5fc5\u987b\u5305\u542b\u9002\u5f53\u7684\u903b\u8f91\u6765\u6d4b\u8bd5\u6570\u636e\u7684\u6b63\u786e\u6027\u3002<\/span> <\/p>\n\u57fa\u672c\u8868\u5355\u9a8c\u8bc1<\/h2>\n
\n<!DOCTYPE html> \n<html> \n \n<head> \n <title>Example of Basic form Validation<\/title> \n <script> \n function validateBasic() { \n var <\/span>name1 = document.basic.name.value; \n var <\/span>qual1 = document.basic.qual.value; \n var <\/span>phone1 = document.basic.phone.value; \n if <\/span>(name1 == \"\"<\/span><\/span><\/span>) { \n alert(\"Name required\"<\/span>);\n return <\/span>false; \n } \n if <\/span>(qual1 == \"\") { \n alert(\"Qualification required\"<\/span>);\n return <\/span>false; \n } \n if <\/span>(phone1 == \"\") { \n alert(\"Mobile number is required\"<\/span>);\n return <\/span>false; \n } \n } \n <\/script> \n<\/head> \n \n<body> \n <center> \n <h1>Basic Form Validation<\/h1> \n <form name=\"basic\"<\/span> action=\"#\"<\/span> onsubmit=\"return <\/span>validateBasic()\"<\/span>> <\/span>\n <table cellspacing = \"2\"<\/span><\/span> cellpadding = \"2\" border = \"1\"<\/span>>\n <tr>\n <td>Name: <\/td>\n <td><input type=\"text\"<\/span><\/span><\/span> name=\"name\"<\/span>><\/td>\n <tr>\n <tr>\n <td> Qualification: <\/td>\n <td><input type=\"text\" name=\"qual\"<\/span>><\/td>\n <\/tr>\n <tr>\n <td>Phone no.:<\/td>\n <td><input type=\"text\" name=\"phone\"<\/span>><\/td>\n <\/tr>\n <\/table>\n <input type=\"submit\"<\/span> value=\"Submit\"<\/span>>\n <\/form> \n <p id=\"d1\"<\/span>><\/p> \n <\/center> \n<\/body> \n \n<\/html><\/pre>\n
\u6570\u636e\u683c\u5f0f\u9a8c\u8bc1<\/h2>\n
\n<!DOCTYPE html> \n<html> \n \n<head> \n <title>Example of Basic form Validation<\/title> \n <script> \n function validateBasic() { \n var <\/span>name1 = document.basic.name.value; \n var <\/span>qual1 = document.basic.qual.value; \n var <\/span>phone1 = document.basic.phone.value; \n var <\/span>id = document.basic.em.value; \n if <\/span>(name1 == \"\"<\/span><\/span><\/span>) { \n alert(\"Name required\"<\/span>);\n return <\/span>false; \n } \n if(name1.length<5){\n alert(\"Username should be atleast 5 characters\"<\/span>);\n return <\/span>false;\n }\n at = id.indexOf<\/span>(\"@\"<\/span>); \n dot = id.lastIndexOf<\/span>(\".\"<\/span>); \n \n if <\/span>(at < 1 ||<\/span><\/span> ( dot-at < 2 )) { \n alert(\"Incorrect Email-ID\"<\/span>) \n return <\/span>false; \n } \n if <\/span>(qual1 == \"\") { \n alert(\"Qualification required\"<\/span>);\n return <\/span>false; \n } \n if <\/span>(phone1 == \"\") { \n alert(\"Mobile number is required\"<\/span>);\n return <\/span>false; \n } \n if(phone1.length<10 || phone1.length>10){\n alert(\"Mobile number should be of 10 digits\"<\/span>);\n return <\/span>false;\n }\n \n } \n <\/script> \n<\/head> \n \n<body> \n <center> \n <h1>Basic Form Validation<\/h1> \n <form name=\"basic\"<\/span> action=\"#\"<\/span> onsubmit=\"return <\/span>validateBasic()\"<\/span>> <\/span>\n <table cellspacing = \"2\"<\/span><\/span> cellpadding = \"2\" border = \"1\"<\/span>>\n <tr>\n <td>Name: <\/td>\n <td><input type=\"text\"<\/span><\/span> name=\"name\"<\/span>><\/td>\n <\/tr>\n <tr>\n <td>Email: <\/td>\n <td><input type=\"email\"<\/span> name=\"em\"<\/span>><\/td>\n <\/tr>\n \n <tr>\n <td> Qualification: <\/td>\n <td><input type=\"text\" name=\"qual\"<\/span>><\/td>\n <\/tr>\n <tr>\n <td>Phone no.:<\/td>\n <td><input type=\"number\"<\/span> name=\"phone\"<\/span>><\/td>\n <\/tr>\n <\/table>\n <input type=\"submit\"<\/span> value=\"Submit\"<\/span>>\n <\/form> \n <p id=\"d1\"<\/span>><\/p> \n <\/center> \n<\/body> \n \n<\/html><\/pre>\n
\n<\/html><\/p>\n","protected":false},"excerpt":{"rendered":"ES6 \u9a8c\u8bc1zh-cn","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[161],"tags":[],"class_list":["post-1936","post","type-post","status-publish","format-standard","hentry","category-es6jc"],"_links":{"self":[{"href":"https:\/\/bianchenghao6.com\/wp-json\/wp\/v2\/posts\/1936"}],"collection":[{"href":"https:\/\/bianchenghao6.com\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/bianchenghao6.com\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/bianchenghao6.com\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/bianchenghao6.com\/wp-json\/wp\/v2\/comments?post=1936"}],"version-history":[{"count":0,"href":"https:\/\/bianchenghao6.com\/wp-json\/wp\/v2\/posts\/1936\/revisions"}],"wp:attachment":[{"href":"https:\/\/bianchenghao6.com\/wp-json\/wp\/v2\/media?parent=1936"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/bianchenghao6.com\/wp-json\/wp\/v2\/categories?post=1936"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/bianchenghao6.com\/wp-json\/wp\/v2\/tags?post=1936"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}