close

阻止其他定義的default動作。

 

例1:

<a href='#' onclick='someFunc(3.1415926); return false;'>Click here !</a>

 

例2:

<input type="button" value="改變顏色" onclick="changeColor(this); return false;">

 

現代寫法:

event.preventDefault();

 

另一寫法:

event.returnValue = false;

 

 

參考:
What's the effect of adding 'return false' to a click event listener?
js中return false,return,return true的用法及區別

 

arrow
arrow

    Robert 發表在 痞客邦 留言(0) 人氣()