表单提交的方法。
<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <meta http-equiv="X-UA-Compatible" content="ie=edge"> <title>Document</title> </head> <body> <form action="http://www.jb51.net"> <input type="text" /> <input type="submit" value="submit" onclick="return validate()" /> </form> </body> <script type="text/javascript"> function validate() { if (confirm("提交表单?")) { return true; } else { return false; } } </script> </html>