当用户在文本区域输入任何数据时,我的"计算"按钮会进行任何计算。在这一点上,我如何保存用户提供的数据,以便将其发送到计算器按钮?有人知道它是怎么回事吗?
这是文本区域,用户给出任何数据
var textAreaHeight = Ti.UI.createTextArea({
borderWidth: 2,
borderColor: '#bbb',
borderRadius: 5,
color: '#888',
font: {fontSize:20,
fontWeight:'bold'},
keyboardType: Ti.UI.KEYBOARD_NUMBER_PAD,
returnKeyType: Ti.UI.RETURNKEY_GO,
left:200,
top: 300,
width: 125,
height : 40
});
这是我的按钮,它使任何假设
var CalculatorButton = Ti.UI.createButton({
title:'Calculate',
top:475,
width:400,
height:90,
left:75
});
你可以这样做
var CalculatorButton = Ti.UI.createButton({
title:'Calculate',
top:475,
width:400,
height:90,
left:75
});
CalculatorButton.addEventListener('click',function(e){
var result=textAreaHeight.value
alert(result);
});
感谢