如果返回 false 的话,将阻止事件的默认行为

解决方案 »

  1.   

    什么是事件的默认行为例如点击a链接会跳转到href指定的页面;点击submit按钮提交表单,点击reset重置表单等
      

  2.   

    什么是事件的默认行为例如点击a链接会跳转到href指定的页面;点击submit按钮提交表单,点击reset重置表单等默认行为即浏览器内置的对事件的处理过程。
      

  3.   

    每一个事件是否执行取决于event.returnValue这个属性默认情况下这个属性是为event.returnValue=true
    这么写也可以简写成return true这两个是相同的 。 当return false的时候就相当于event.returnValue= false 
    至于event下面都有什么属性和方法可以用for in 遍历来查看当然如果你做web可以这么做
      

  4.   

    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml">
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <title>无标题文档</title>
    </head>
    <body>
    <form onsubmit="return fun(event)"><input type="submit" id="input" value="狂 点" /></form>
    <script>
    function fun(e){
    var evt=e||window.event;
    var str;
    for(pro in evt){
    str+='event.'+pro+'='+evt[pro]+"<br />";
    document.getElementById("div").innerHTML=str;
    }
    return false;
    }
    </script>
    <div id="div"></div>
    </body>
    </html>
    补充一下这个段简单代码可以输出event一些属性和方法