document.myform.SmallClassID.options[o]<----这个是第一个元素也就是第一项。
document.myform.smallclassid.options=1;
document.myform.SmallClassID.options[document.myform.SmallClassID.length]<----那么这个该是什么,我理解不来,不懂,请解释。很不懂,真的不懂~~

解决方案 »

  1.   

    document.myform.SmallClassID
    网页,表单,下拉列表
    兄弟你对照HTML代码看呀!不要灰心!慢慢来
      

  2.   

    document.myform.SmallClassID.options[document.myform.SmallClassID.length]我想问[document.myform.SmallClassID.length]跟在document.myform.SmallClassID.options是什么意思?
      

  3.   

    [document.myform.SmallClassID.length]跟在document.myform.SmallClassID.options后面是什么意思?
      

  4.   


    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml">
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
    <title>Untitled Document</title>
    <script type="text/javascript">
    function init(){
    alert(document.myform.SmallClassID.length);
    }
    </script>
    </head><body onload="init()">
    <form name="myform">
    <select name="SmallClassID">
    <option value="1">root</option>
        <option value="2">Member</option>
    </select>
    </form>
    </body>
    </html>
      

  5.   

    如果document.form.smallclassid.length=1设置成1
    而我的select里有5个option,那为什么下拉列表中有5个option,我已经将document.form.smallclassid.length=1设置成了1,为什么还显示出5个来
      

  6.   

    document.myform.SmallClassID.length
    re:
    select中的option数目document.myform.SmallClassID.options
    re:
    select中的所有option的一个数组document.myform.SmallClassID.options[document.myform.SmallClassID.length]
    re:
    找出select中的第x个option,x=select中的option数目这段代码有问题吧!应该是这样吧:
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml">
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
    <title>Untitled Document</title>
    <script type="text/javascript">
    function init(){
    alert(document.myform.SmallClassID.options[document.myform.SmallClassID.length-1].value);
    }
    </script>
    </head><body onload="init()">
    <form name="myform">
    <select name="SmallClassID">
    <option value="1">root</option>
        <option value="2">Member</option>
        <option value="3">admin</option>
    </select>
    </form>
    </body>
    </html>
      

  7.   

    length是一个只读属性的!不能更改或重赋值!
      

  8.   

    你到底要选中select中的第一个还是最后一个option
      

  9.   

    document.myform.SmallClassID.length=1
    for (i=0;i<5;i++)
    document.myform.SmallClassID.options[document.myform.SmallClassID.length]=new option("123")
    document.myform.SmallClassID.options[document.myform.SmallClassID.length]=new option("123")
    这句请解释下,是不是把123选项放进长度为1的下拉列表中?可如果我循环了5次,为什么长度会拉长到5个?我这里是将长度设置成1的呀,循环了5次,可为什么长度会拉长?然到选项一增加,length长度设置成1就失灵了吗?
      

  10.   

    document.myform.SmallClassID.options[document.myform.SmallClassID.length]=new option("123") 这行!如果没有option对象!是不会起作用的!
      

  11.   

    可如果我循环了5次,为什么长度会拉长到5个
    re:
    0,1,2,3,4是不是5个数!我这里是将长度设置成1的呀
    re:
    你设置在先!添加在后!哪最后的结果不应该是5 个么?循环了5次,可为什么长度会拉长? 
    re:
    不拉长!哪说明!循环写的不对!不拉长,为什么要写循环length长度设置成1就失灵了吗? 
    re:
    代码是从上到下依次执行的(如果没有exit).问题好好想想再写!
      

  12.   

    <script language="javascript">
    document.myform.smallclassid.length=1;
    document.myform.SmallClassID.options[document.myform.SmallClassID.length]=new option("123") 
    document.myform.SmallClassID.options[document.myform.SmallClassID.length]=new option("456") 
    document.myform.SmallClassID.options[document.myform.SmallClassID.length]=new option("789") 
    </script>
    等同于
    <form name="myform">
    <select name="smallclassid">
    <option>123</option>
    <option>456</option>
    <option>789</option>
    </select>
    </form>我想问的是我在脚本里设置了length=1,为什么显示出来的长度会有三个选项那么长?请指教!
    那么在脚本里的设置length=1,是不是就失灵了?
      

  13.   


    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml">
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
    <title>Untitled Document</title>
    <script type="text/javascript">
    function init(){
    document.myform.SmallClassID.length=1 
    }
    </script>
    </head><body onload="init()">
    <form name="myform">
    <select name="SmallClassID">
    <option value="1">root</option>
        <option value="2">Member</option>
        <option value="3">admin</option>
    </select>
    </form>
    </body>
    </html>
      

  14.   

    document.myform.SmallClassID.options[0]=new option("123")这句赋值我懂.document.myform.SmallClassID.options[document.myform.SmallClassID.length]=new option("123") 
    可为什么这句也可以给长度赋值呢?
      

  15.   

    document.myform.SmallClassID.length=1这句是无效的,因为length属性是只读,不能改的.