document.f.one_xmmc.select();
这个是什么方法?实现了没?

解决方案 »

  1.   

    判断的时候不能申明是否为空。
    应该是把默认值放上去。比如
    <select name="select">
    <option value="a" selected>a</option>
    <option value="x">x</option>
    </select>
    select默认值是a
    那判断的时候就应该是当值为a的时候弹出提示
      

  2.   

    是文本正常,但下拉框就不行,根本没法验证
    if ((document.f.one_dqid.value).length==0 )
    {
    alert("请选择地区!");
    document.f.one_dqid.focus();
    document.f.one_dqid.select();
    return false;
    }
    select用你这种方法不行的.
    Try..
    if(document.f.one_dqid.options[document.f.one_dqid.options.selectedIndex].value=="")
     {
       alert("请选择地区")
       document.f.one_dqid.focus();
       //document.f.xx.select(),SELECT没有这种方法.文本可以.
       return false;
     }demo.htm<script>
    function check(obj)
    {
      if(obj.options[obj.options.selectedIndex].value=="")
      {
       alert("请选择地区")
       obj.focus();
       //document.f.xx.select(),SELECT没有这种方法.文本可以.
       return false;
      }
    }
    </script>
    <select name=sel>
    <option value="">地区
    <option value="1">1
    <option value="2">2
    </select>
    <input type=button onclick="check(document.all.sel)">
      

  3.   

    to: wanghr100(灰豆宝宝.net )
     
      

  4.   

    按错了,刚才,我按你办法不行,因为我的选择框是用onchange="vbs:change me"这一生成的,他一开始我也不知什么值,
    不过我用alert(document.f.one_dqid.optionsdocument.f.one_dqid.options.selectedIndex].value);来显示他的值是,弹出的对话框是一个空值,证明他是为空,但为什么就检测不到,
      

  5.   

    alert(formName.selectName.value)就可以。
    谈出对话框是空的不意味着""如果是" "你也看不到东西
      

  6.   

    哪怎么解决呢,为" "也是要拦住的呀,有时也显示为undefinde这个,不知为什么,
      

  7.   

    undefinde说明下来列表中没有值
    给个默认值吧
      

  8.   

    select框中是这样的给值,我怎么给默认值呀,实际他下拉表框中有,呀
    <SCRIPT LANGUAGE=vbscript >
    Dim d,o  ' 创建对象变量。
    Set d = CreateObject("Scripting.Dictionary")
     d.Add " ","全部"
    <%addfirst x%>
    dim x:x=<%=x%>
    dim first:first="<%=first%>"
    remove x '移除  
    addo x '增加
    sub remove(x)'移除
    for each ooo in eval("parent.f.S" & x & ".options")
    execScript "parent.f.S" & x & ".remove " & ooo.index,"vbs"
    next
    end sub
    sub addo(x) '增加
     for each code in d.Keys
    set o=document.createElement("option")
    o.text=d.Item(code)
    o.value=code
    execScript "parent.f.S" & x & ".add o","vbs"
     next
     'execScript "parent.f.S" & x & ".sele o","vbs"
    end sub
     if x <3 and eval("parent.f.S" & x & ".length")<>0 then window.location.href="QDanW.asp?x=" & x & "&first=" & first
    </SCRIPT>
      

  9.   

    if replace(formName.selectName.value,chr(32),"")="" or formName.selectName.value="undefined" then
      

  10.   

    不行呀,我又发了一贴子,http://expert.csdn.net/Expert/topic/2858/2858964.xml?temp=.4219477
    这个虽然好用,是超级大笨狼的代码,但后续的问题也很多!