看你的代码应该是表单的验证: 表单的验证一般这样写:<form action=index.asp onsubmit="return e()"><script>
function e()
{
    if(document.form1.old_ps.value="")
    {
        alert('请先输入原来的密码,再作更改操作!!');
        return false; //返回 false 则表单不会被提交
    }
    return true;  //返回 true 则提交表单
}
</script>

解决方案 »

  1.   

    问题我有好几个submit,有些跳到不同的页面,有些是本页验证,若写在form里,那不是所有的submit都跳走了吗?
      

  2.   

    不同得submit可以用不同的form。
    return 就跳出函数的执行了。
    onclick="ttt();"ttt()
    {
      if not e()
      { return false;}
      action:="aaa.asp";
    }
      

  3.   

    function e()
    {
    if(document.form1.old_ps.value="") {
    alert('请先输入原来的密码,再作更改操作!!');
    }
    else
    action=“aaa.asp”
    }
    }
    onclick="e">
    帮看看这样写对吗?
      

  4.   

    function e()
    {
    if(document.form1.old_ps.value="") {
    alert('请先输入原来的密码,再作更改操作!!');
    }
    else
    action=“aaa.asp”
    }
    }
    <onclick="e()">
    帮看看这样写对吗?