源代码 :
点击运行
<!DOCTYPE html> <html> <head> <meta charset="utf-8"> </head> <body> <form action="demo_form.php" method="post"> <input type="text" name="fname" required="required"> <input type="submit" value="提交"> </form> <p>点击提交按钮,如果输入框是空的,浏览器会提示错误信息。</p> </body> </html>
运行结果