如何在$link = mysql_connect('localhost', 'mysql_user', 'mysql_password');
if (!$link) {
die('Could not connect: ' . mysql_error());
}
echo 'Connected successfully';
mysql_close($link);
内的Android上的Appcelerator中检测Backspace
?
事件TextField
和change
不起作用。
keypressed
答案 0 :(得分:2)
使用"更改"事件并比较textfield.value。如果它小于旧值,则用户删除了一些内容:
var text_phone_1 = Ti.UI.createTextField({
top: 40,
left: '22.5%',
width: '100%',
returnKeyType: Titanium.UI.RETURNKEY_DONE,
keyboardType: Titanium.UI.KEYBOARD_PHONE_PAD,
hintText: '●',
textAlign: Ti.UI.TEXT_ALIGNMENT_CENTER,
maxLength: 100,
});
var oldText = text_phone_1.value;
text_phone_1.addEventListener("change",function(e){
var lessText = (text_phone_1.value.length < oldText.length);
oldText = text_phone_1.value;
if (lessText) {
alert("Backspace");
}
})