简化js--函数返回
<script type="text/javascript"> function a(){ return false; } function b(){ return true; } function check(){ if(a()&&b()){ return true; }else{ return false; } } </script> <form action="http://www.cnblogs.com" onsubmit="return check()"> <input type="submit" value="提交"/> </form>
上面的check函数可以简写为:
function check(){ return a() && b() ? true :false; }
本文来自博客园,作者:tinyphp,转载请注明原文链接:https://www.cnblogs.com/tinyphp/p/3394333.html
向着星辰与深渊,博客园加油

浙公网安备 33010602011771号