按照你的设想,此段函数应该是这样写的function check() { 
  if(document.getElementById("txt_code").value=="") {
    alert("单号不能为空,请填写!"); 
    return false; 
  } 

//////////////////////// 
function pp() { 
  if (!check()) return false;
  document.getElementById("txt_code").value="123456"; 
  return false; 
}
注意,check()函数return false后,退出的是check()函数,而不是所有函数。即没有退出pp函数

解决方案 »

  1.   

    check()中return false是不执行本方法以后的代码,这时候他会返回调用它的哪行代码继续向下执行
      

  2.   

    this?<input id="txt_code" onblur="alert(pp())"> 
    <script language="javascript">
    <!--
    function check() { 
    if(document.getElementById("txt_code").value==""){
    alert("单号不能为空,请填写!"); 
    return false; 
    }
    return true 
    } function pp(){ 
    if (!check()){
    document.getElementById("txt_code").value="123456"; 
    }
    return false; 
    }
    //-->
    </script>