关闭

Js下拉框选择

标签: JShtml
93人阅读 评论(0) 收藏 举报
                      html中定义 <select data-bind="options: $root.EndTimeList, value: $root.EndTimeInfo, optionsValue: 'VALUE', optionsText: 'NAME'">
                                     </select>
                                        <select data-bind="options: $root.EndSecondList, value: $root.EndSecondInfo, optionsValue: 'VALUE', optionsText: 'NAME'">

                                     </select>


self.EndTimeList =ko. ko.observableArray();

self.EndTime = ko.observable();

       self.EndTimeList = ko.observableArray([{ NAME: '1', VALUE: '1:' }, { NAME: '2', VALUE: '2:' }, { NAME: '3', VALUE: '3:' }, { NAME: '4', VALUE: '4:' }
           , { NAME: '5', VALUE: '5:' }, { NAME: '6', VALUE: '6:' }, { NAME: '7', VALUE: '7:' }, { NAME: '8', VALUE: '8:' }
           , { NAME: '9', VALUE: '9:' }, { NAME: '10', VALUE: '10:' }, { NAME: '11', VALUE: '11:' }, { NAME: '12', VALUE: '12:' }
           , { NAME: '13', VALUE: '13:' }, { NAME: '14', VALUE: '14:' }, { NAME: '15', VALUE: '15:' }, { NAME: '16', VALUE: '16:' }
           , { NAME: '17', VALUE: '17:' }, { NAME: '18', VALUE: '18:' }, { NAME: '19', VALUE: '19:' }, { NAME: '20', VALUE: '20:' }
           , { NAME: '21', VALUE: '21:' }, { NAME: '22', VALUE: '22:' }, { NAME: '23', VALUE: '23:' }, { NAME: '24', VALUE: '24:' }]);
        //分
        self.EndSecondList = ko.observableArray([{ NAME: '00', VALUE: '00' }, { NAME: '01', VALUE: '01' }, { NAME: '02', VALUE: '02' }, { NAME: '03', VALUE: '03' }, { NAME: '04', VALUE: '04' }
            , { NAME: '05', VALUE: '05' }, { NAME: '06', VALUE: '06' }, { NAME: '07', VALUE: '07' }, { NAME: '08', VALUE: '08' }
            , { NAME: '09', VALUE: '09' }, { NAME: '10', VALUE: '10' }, { NAME: '11', VALUE: '11' }, { NAME: '12', VALUE: '12' }
            , { NAME: '13', VALUE: '13' }, { NAME: '14', VALUE: '14' }, { NAME: '15', VALUE: '15' }, { NAME: '16', VALUE: '16' }
            , { NAME: '17', VALUE: '17' }, { NAME: '18', VALUE: '18' }, { NAME: '19', VALUE: '19' }, { NAME: '20', VALUE: '20' }
            , { NAME: '21', VALUE: '21' }, { NAME: '22', VALUE: '22' }, { NAME: '23', VALUE: '23' }, { NAME: '24', VALUE: '24' }
            , { NAME: '25', VALUE: '25' }, { NAME: '26', VALUE: '26' }, { NAME: '27', VALUE: '27' }, { NAME: '28', VALUE: '28' }
            , { NAME: '29', VALUE: '29' }, { NAME: '30', VALUE: '30' }, { NAME: '31', VALUE: '31' }, { NAME: '32', VALUE: '32' }
            , { NAME: '33', VALUE: '34' }, { NAME: '35', VALUE: '36' }, { NAME: '37', VALUE: '38' }, { NAME: '39', VALUE: '39' }
            , { NAME: '40', VALUE: '40' }, { NAME: '40', VALUE: '40' }, { NAME: '41', VALUE: '42' }, { NAME: '43', VALUE: '43' }
            , { NAME: '44', VALUE: '44' }, { NAME: '45', VALUE: '45' }, { NAME: '46', VALUE: '46' }, { NAME: '47', VALUE: '47' }
            , { NAME: '48', VALUE: '48' }, { NAME: '49', VALUE: '49' }, { NAME: '50', VALUE: '50' }, { NAME: '51', VALUE: '51' }
            , { NAME: '52', VALUE: '52' }, { NAME: '53', VALUE: '53' }, { NAME: '54', VALUE: '54' }, { NAME: '55', VALUE: '55' }
            , { NAME: '56', VALUE: '56' }, { NAME: '57', VALUE: '57' }, { NAME: '58', VALUE: '58' }, { NAME: '59', VALUE: '59' }
            , { NAME: '60', VALUE: '60' }


        ]);



后台js直接使用对象可以获取到下拉框选择的数据

0
0

查看评论
* 以上用户言论只代表其个人观点,不代表CSDN网站的观点或立场
    个人资料
    • 访问:1911次
    • 积分:88
    • 等级:
    • 排名:千里之外
    • 原创:7篇
    • 转载:1篇
    • 译文:0篇
    • 评论:0条
    文章分类