【发布时间】:2015-02-08 20:59:44
【问题描述】:
在钛合金中,我制作了一个由“行”组成的拾取器。用户可以选择这些行之一并单击按钮以继续到下一个窗口。我想要的是该按钮根据选择器中的选定行将用户发送到右侧窗口。我的代码如下:
合金:
<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();
}
});
问题是每次选择都会将用户发送到同一个新窗口,就像 else 语句被忽略一样。我该如何解决这个问题?
【问题讨论】:
标签: javascript jquery xml titanium titanium-alloy