(051)javascript_event_prevent_form

 1 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
 2 <html xmlns="http://www.w3.org/1999/xhtml">
 3 <head>
 4     <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
 5     <title>EVENT</title>
 6     <style type="text/css">
 7     </style>
 8     <script type="text/javascript">
 9 
10         window.onload = function() {
11 
12             var myForm = document.getElementById("myForm");
13 
14             myForm.onsubmit = function() {
15                 return false;
16             }
17         };
18     </script>
19 </head>
20 
21 <body>
22 
23     <form id="myForm" action="http://www.baidu.com">
24         <input type="submit" value="submit"/> 
25     </form>
26     
27 </body>
28 </html>

 

posted @ 2014-03-23 11:49  雪中飞雁  阅读(79)  评论(0)    收藏  举报