<html>
<body>
<script type="text/javascript">
function DisplayComment(){
alert("请不要连续评论");
}
</script>
<a href="javascript:DisplayComment(); void(0);">测试</a>
</body>
</html>

解决方案 »

  1.   


    <script language=javascript>function DisplayComment(){
    if (true)alert("请不要连续评论");return; //不要false
    alert('not run');
    }</script>
    <a href="javascript:DisplayComment();">链接</a>        <!-- href 中也不用 return -->
            
      

  2.   

       <script language=javascript>function DisplayComment(){
            if (true)alert("请不要连续评论");return; //不要false
            alert('not run');
            }</script>
        <a href="javascript:DisplayComment();">链接</a>
      

  3.   

    或者这样:<html>
    <body>
    <script type="text/javascript">
    function DisplayComment(){
        alert("请不要连续评论");
    }
    </script>
    <a href="javascript:DisplayComment(); return false">测试</a>
    </body>
    </html>