其中可以知道value的属性,有人说bbb是 text属性?或label属性,都不行,急死了

解决方案 »

  1.   

    <select onchange=alert(this.options[this.selectedIndex].text)>
    <option value=c>aaa</option>
    <option value=c1>aaa1</option>
    </select>
      

  2.   

    text属性!
    new Option(text, value, defaultSelected, selected)
      

  3.   

    <html>
    <body>
    <form id=form1>
    <script>
    function creopt(){
    var obj,obj1;
    obj=document.all.sel;
    obj[obj.length]=new Option("bbbb", "vv", false, false);
    }
    </script>
    <select id=sel name=sel>
    <option id=aaa value=aaa>aaa</option>
    </select>
    <input type=button value="create" onclick="javascript:creopt();">
    <input type=button value="check" onclick="alert(document.all.sel.value);">
    </form>
    </body>
    </html>
      

  4.   

    AvailabilityJavaScript 1.0; enhanced in JavaScript 1.1 
    Inherits from/OverridesInherits from HTMLElement 
    Synopsis
    select.options[i]ConstructorIn JavaScript 1.1, Option objects can be dynamically created with the Option( ) constructor, as follows: 
    new Option(text, value, defaultSelected, selected)Arguments
    textAn optional string argument that specifies the text property of the Option object. 
    valueAn optional string argument that specifies the value property of the Option object. 
    defaultSelectedAn optional boolean argument that specifies the defaultSelected property of the Option object. 
    selectedAn optional boolean argument that specifies the selected property of the Option object.