<script language=vbscript>
function checkinput()
  if document.form2.xm.value="" then
      alert " 请输入姓名!"
      document.form2.xm.focus
      window.event.returnValue=false
      document.form2.add.click
  end if
end function 
</script>简单啦。呵呵,应该没有错吧?

解决方案 »

  1.   

    sub checkinput()
    end sub
      

  2.   

    :)呵呵,全错了!好好看一下VBS语法的书吧!!VBS中有alert吗?
      

  3.   

    <script language="vbscript">
    function checkinput()
      if document.form2.xm.value = "" Then
          msgbox "请输入姓名!"
          document.form2.xm.focus()
          checkinput = false
      else
          checkinput = true
          document.form2.add.click()
          window.event.returnValue=false
      end if
    end function
    </script><form name=form2 onsubmit="return checkinput()">
    <input type=text name=xm>
    <input type=button name=add value=add onclick="vbscript:msgbox 'add is clicked'">  
    <input type=submit value=submit>  
    </form>  
      

  4.   

    zcflion(吃大白菜的鸟--菜鸟) 
    谁说没有alert函数?这个函数是DHTML中window对象的一个方法。默认情况下可以直接使用alert "xxxxx"来显示对话框的!不信你试试。