onclick="func()"和 onclick = "return func()"区别

onclick="func()" 表示只会执行 func , 但是不会传回 func 中之回传值
onclick = "return func()" 则是 执行 func 并传回 func 中之回传值
范例:
<script>
function doAlert() {
//alert("#");
var fail_this_check = true;
if(fail_this_check)
return false;
else
return true;
}
</script>
with return <input type="checkbox" onclick="return doAlert()" /><br/>
without return <input type="checkbox" onclick="doAlert()" />

使用 return doAlert() 的 checkbox 会因为 func 回传 false 而中断 click 动作
原文地址:https://www.cnblogs.com/uoar/p/7729603.html