你这儿是需要判断,而不是return
如:
<a onclick="if(isTrue()) window.location='http://www.baidu.com';else window.location='http://www.sohu.com';" style="cursor:hand">return isFalse</a>
如:
<a onclick="if(isTrue()) window.location='http://www.baidu.com';else window.location='http://www.sohu.com';" style="cursor:hand">return isFalse</a>
<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>
作用一:一个是得到返回值。
作用二:另一个是终于程序的执行,即return 后面无论写什么,当然都不会执行了,因为程序已经终止了,跳出了此判断。
你可以把你想要做的事情和效果写清楚,大家一起帮你想办法啊。··