确定的时候
在按钮的onclick函数里面进行判断

解决方案 »

  1.   

    我是问form.choiceBox.options.text==""还是form.choiceBox.value=="",还是什么,我写的都不行
      

  2.   

    function Check(form)
    {
     if(form.choiceBox.option.length==0)
       {
           window.alert("请输入SMTP服务器!");
        }
    }
    <form name="form" method="post" action="GroupSetResult.jsp" onSubmit="Check(this)">
    执行submit,为什么javascrip不检查??
      

  3.   

    if(form.choiceBox.option.length==0)
    ->
    if(form.choiceBox.options.length==0)
    你少一个s
      

  4.   

    哦,我看到了,我在程序中并没有忘记,(form.choiceBox.options.length==0)仍不能自动检查
      

  5.   

    <script>
    function Check(form)
    {
     if(form.choiceBox.options.length==0)
       {
           window.alert("请输入SMTP服务器!");
           event.returnValue=false
        }
    }
    </script>
    <form name="form" method="post" action="GroupSetResult.jsp" onSubmit="Check(this)">
    <select id=choiceBox>
    </select>
    <input type=submit>
    </form>
      

  6.   

    上面的我写过,确实能执行,可是本程序中,我又加了个else,就不行了,是什么原因呢,怎么做?
    for(i=0;i<choiceBox.options.length;i++)
    {choiceBox.options(i).selected=true)}