<form onsubmit="return checkform()">根据你的 checkform() 函数返回值是 true/false 决定是否提交

解决方案 »

  1.   

    楼上用js
    下面是vbs:<input type=submit name=sumt1 onclick="formSubmit()">
    <script language=vbscript>
    Sub formSubmit()
      msgbox "输入有误?"
      window.event.returnValue=false
    End Sub
    </script>
    :_)
      

  2.   

    谢谢,我要用js,有没有类似楼上的vbs的这种实现方法,因为我有好几个校验函数,不能在form时一起提交!
      

  3.   

    <input type=submit name=sumt1 onsubmit="return checkform()">
    <script language=javascript>
    function checkform(){
      if(is false)//条件判断
        {alert( "输入有误?");
          window.formname.elementname.onfocus();
      return false}}
    </script>
      

  4.   

    楼上的方法不行啊,我知道怎么样设焦点,不知道怎么终止网页继续执行!用return false不能终止按钮命令!
      

  5.   

    js:
    <FORM METHOD=POST ACTION="">
    ....
    <input type=submit name=sumt1 onclick="formSubmit()">
    </FORM><script language="javascript">
    function formSubmit()
    {
      alert("输入有误?");
      window.event.returnValue=false;
    }
    </script>:_)