Dojo滑块设置值问题

时间:2011-07-06 10:01:44

标签: javascript jquery dojo

有人可以告诉我如何在某个值上设置滑块(Dojo滑块)吗?

        var vertical_monday = dojo.byId("vertical_monday");
        var rulesNodeMonday = document.createElement('div');
        vertical_monday.appendChild(rulesNodeMonday);

        var sliderRulesMonday = new dijit.form.VerticalRule({
            count: 24,
            style: "width:5px;"

        },
        rulesNodeMonday);
        var slider = new dijit.form.VerticalSlider({
            name: "vertical_monday",
            value: 0,
            minimum: 1440,
            maximum: 0,
            pageIncrement:100,
            showButtons:true,
            slideDuration:289,
            discreteValues: 289,
            intermediateChanges:false,
            style: "height:450px;",
            onChange: function(value) {
                dojo.byId("sliderValueMonday").value = value;
                val_monday=value;
                var a=(500*(value-used_length_monday))/1440;
                //alert('a='+a);
                var temp_id='mon_'+temp_daily_plan_monday;
                //used_length=used_length+a;
                $('#'+temp_id).css('height',a);
            }
        },
        vertical_monday);

如何从代码中将此滑块设置为例如200的值(我需要编写函数来设置此参数----函数set_slider_val(number))?

1 个答案:

答案 0 :(得分:2)

所有dijits都使用set方法设置属性,包括value属性。

function set_slider_val(number) {
    dijit.byId("yourSliderId").set("value", number);
}