1
我是一個學生,所以我詢問這樣一個簡單的問題道歉。我試圖做一個「下一個和‘上一個’按鈕,通過陣列一次一個循環。循環通過一個按鈕陣列,鈦
var food = ["pasta", "Salad", "Apple", "Pizza"];
counter=0;
var displayAlert = function(){
for (var i=0, item; i<food.length; i++) {
item = food[i];
quoteText.text=food[i];
}
};
var quoteView = Ti.UI.createView({
backgroundColor: "#fff",
height: 150,
top: 50,
left: 20,
right: 20,
borderRadius: 5
});
var quoteText = Ti.UI.createLabel({
text: "click below to begin",
font: {fontSize: 20, fontFamily: "Arial"},
textAlign: "center"
});
quoteView.add(quoteText);
mainWindow.add(quoteView);
buttonPrevious.addEventListener("click", displayAlert);
buttonNext.addEventListener("click", displayAlert);
沒有必要道歉。你到底是想要做什麼?你想輸出上的每個按鈕全陣列式點擊嗎?你要輸出的下一首/上點擊按鈕上的數組的項目? – mwfire