表单验证
你很可能见过网络中的表单在用户错误地填写表单控件后会弹出错误提示消息。
<!DOCTYPE html> <!-- To change this license header, choose License Headers in Project Properties. To change this template file, choose Tools | Templates and open the template in the editor. --> <html> <head> <title>TODO supply a title</title> <meta charset="UTF-8"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> </head> <body> <div>TODO write content</div> <form action="http://www.example.com/login/" method="post"> <label for="username">用户名:</label> <input type="text" name="username" required="required" /></title><br /> <label for="password">密码:</label> <input type="password" name="password" required="required" /> <input type="submit" value="Submit" /> </form> </body> </html>