你这儿是需要判断,而不是return
如:
<a onclick="if(isTrue()) window.location='http://www.baidu.com';else window.location='http://www.sohu.com';" style="cursor:hand">return isFalse</a>

解决方案 »

  1.   

    TO:如果在onclick里加上return ,即后面的东西就跑不动了,无论是true或false你既然已经都返回了,那怎么会执行后面的代码呢?
      

  2.   

    <html>
    <head>
    <title></title>
    </head>
    <body leftMargin=0 topMargin=0 marginwidth="0" marginheight="0">
    <script>
    function isFalse(){
    alert("false")
    return false;
    alert("true")
    }
    function isTrue(){
    alert("false")
    return true;
    alert("true")
    }
    </script>
    <a onclick="if(isFalse())window.location='http://www.baidu.com'" style="cursor:hand">return isFalse</a>
    <br>
    <br>
    <a onclick="if(isTrue())window.location='http://www.sohu.com'" style="cursor:hand">return isTrue</a>
    </body>
    </html>
      

  3.   

    既然return了,那就终止了,不会执行后面的代码
      

  4.   

    看来你是没有弄清楚return 的作用啊,
      作用一:一个是得到返回值。
      作用二:另一个是终于程序的执行,即return 后面无论写什么,当然都不会执行了,因为程序已经终止了,跳出了此判断。
      你可以把你想要做的事情和效果写清楚,大家一起帮你想办法啊。··