• Source

    <HTML>
    <BODY>
    <SCRIPT Language="JavaScript">
    function DisplayProperties() {
          n = document.Form1.City.length;
          i = document.Form1.City.selectedIndex;
          c1 = document.Form1.City.options[i].defaultSelected;
          c2 = document.Form1.City.options[i].selected;
          c3 = document.Form1.City.options[i].value;
          c4 = document.Form1.City.options[i].text;
          window.alert( "n=" + n + ", i=" + i + ", defaultSelected="+c1 + ", selected=" + c2 + ", value=" + c3 + ", text=" + c4);
       }
    </SCRIPT>
    
    <FORM Name=Form1>
    
    <SELECT Name=City>
        <OPTION Value=Taipei>台北市
        <OPTION Value=Taichung>台中市
        <OPTION Value=Tainan>台南市
        <OPTION Value=Kaohsiung Selected>高雄市
    </SELECT><P>
    <INPUT Type=Button Value="顯示屬性" OnClick="DisplayProperties();">
    </FORM>
    </BODY>
    </HTML>