在鈦合金中,我製作了一個由「行」組成的選取器。用戶可以選擇這些行中的一個,然後單擊一個按鈕繼續到下一個窗口。我想要的是,按鈕將用戶發送到右側窗口,具體取決於選擇器中選定的行。我的代碼如下:從鈦合金選取器中選取一行
合金:
<Alloy>
<Window>
<Picker id="picker">
<Column id="rows">
<Row title="Row1" />
<Row title="Row2" />
<Row title="Row3" />
<Row title="Row4" />
</Column>
</Picker>
<Button id="button" title="Confirm" bottom="10%" width="115" height="50" />
</Window>
</Alloy>
的JavaScript/jQuery的:
$.picker.addEventListener('change',function(e) {
var selectedrow = e.rowIndex; // e.rowIndex determines row number
});
$.button.addEventListener('click',function(e) {
if(selectedrow = "3") {
$.tabs.open();
}
else {
$.tabs2.open();
}
});
的問題是,每一個選擇向用戶發送到同一個新的窗口,像其他語句正在被忽略。我怎樣才能解決這個問題?
也'selectedrow'變量必須是全球性的。 – turtle 2015-02-09 06:08:17