在function 中用return
function fun(){
  if (x==2) return;
  x=x+1;
}
在过程中用breakfunction fun(){
x=0;
while(0){
x++;
if (x>10000) break;
}
}

解决方案 »

  1.   

    我的问题是这样: 我在sumit按钮的onclick事件里给了一个check程序来检验用户输入的正确性,如果输入错误,就停止, 但是用了return后,这个form还是会提交到下个程序,怎么办???
      

  2.   


    <FORM NAME="search" ACTION="inq_cheque.php" METHOD="POST" ONSUBMIT="return (confirm('确认删除?'))">   <input type="submit" name="Submit" value="提交">
    </form>
      

  3.   

    retrun true,提交;return false,返回
      

  4.   

    TO  maurice1978(小乜):
    引用时:onsubmit="return you_function();"
                     ~~~~~~
    如果输入错误,就从Function 里return false
      

  5.   

    下面是form的一部分:
    <form name="form1" method="post" action="Untitled-1.jsp" onsubmit="Javascript:check_input()">我想让提交的数据出错后,就不提交数据了,该怎么办??
      

  6.   

    weidegong(weidegong) 你说的容易,我也知道啊,但具体程序怎么写啊?