2011-10-14 55 views
2

我有這段代碼,我的目標是獲取數組對象。 螢火蟲沒有錯誤,但沒有顯示任何值(始終爲undefined)。什麼是正確的方法來做到這一點?獲取數組的值

var sizes = ["a","b","c","d","e","f"]; 

var s = new dijit.form.HorizontalSlider({ 
       value:1, 
       name:"i"+[i], 
       onChange:function(sizes, val){ 
        dojo.byId('value'+[i]).value = sizes[val]; 
        }, 
       minimum:1, 
       maximum:sizes.length -1, 
       discreteValues:sizes.length, 

      },node); 

jQuery中的樣子:

var sizes = ["0","2","4","6","8","10","12","14","16","18","16W","18W","20W"]; 
$("#slider-size .slider").slider({ 
    min: 0, 
    max: sizes.length - 1, 
    step: 1, 
    slide: function(event, ui) { 
    $(".rsize").text(sizes[ui.value]); 
    } 
}); 

here

+0

這看起來不合法的Javascript。你忽略了一個封閉的對象 - 文字嗎? –

+0

@vivian,更新了問題 –

+0

你能否澄清你究竟在做什麼? 'onChange'事件函數只接受一個參數'value'。 – BuffaloBuffalo

回答

0
minimum:0, 

的問題。謝謝