我已创建和Android手机间隙应用程序。我想要做的是我在我的应用程序中有一个删除按钮,当我们长按一个按钮时,它应显示一条符合条件的消息:“你要删除该帐户吗? “我们使用点击功能,它的工作正常,不能长按,任何人都可以告诉谁这样做。 这是我用于longpress的代码
$(document).on(function(){
$("#taphold").bind("taphold",function(){
var hi=confirm("Do you really want to delete data");
if(hi==true) {
db.transaction(function(tx){
tx.executeSql(deleterecord,[id]);
alert("Record Deleted Successfully");
parent.location='file:///android_asset/www/index.html';
});
}else{
alert("Data not deleted");
}
});});
提前致谢
答案 0 :(得分:0)
在按钮单击侦听器中使用通知...
// process the confirmation dialog result
function onConfirm(button) {
alert('You selected button ' + button);
}
// Show a custom confirmation dialog
//
function showConfirm() {
navigator.notification.confirm(
'You are the winner!', // message
onConfirm, // callback to invoke with index of button pressed
'Game Over', // title
'Restart,Exit' // buttonLabels
);
}
有关详情,请查看.. Phone gap doc