<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>New Web Project</title> </head> <body> <form name="myform" method="post" action=""> <input type="submit" name="mybutton" value="提交" onclick="return clickHandler()" /> </form> <script language="javascript"> function clickHandler() { alert("即将提交表单"); return false; } myform.mybutton.onclick();//主动激发onclick事件 </script> </body> </html>