【发布时间】:2013-07-09 12:28:35
【问题描述】:
我花了一些时间试图找出为什么我的应用程序上的自定义通知无法正常工作。
以下是我的 .js 中的代码:
if (inputOne > maxAllowed)
{
showMessage("Your Input is too high.",null,"Warning","Warning");
}
以下是我的 .html 中的代码:
document.addEventListener("deviceready", onDeviceReady, false);
function onDeviceReady() {
// Now safe to use the PhoneGap API
}
function showMessage(message, callback, title, buttonName) {
title = title || "Warning!";
buttonName = buttonName || 'Warning!';
if(navigator.notification && navigator.notification.alert) {
navigator.notification.alert(
message, // message
callback, // callback
title, // title
buttonName // buttonName
);
} else {
alert(message);
}
在我的 PhoneGap 的 config.xml 中,我有:
以下是我用来获取此链接的链接:
http://docs.phonegap.com/en/2.9.0/cordova_notification_notification.md.html#Notification
发生的情况是,它只使用了else 部分并正常工作。
.html 来自以下链接:
Custom JavaScript alerts in iOS using PhoneGap HTML
有什么想法吗?
谢谢,感谢您的帮助。
亲切的问候,
加里·舍吉尔
【问题讨论】:
-
相对于底部的 sn-p,代码中顶部的 sn-p 位于何处?
-
它们位于两个不同的文件中。 showMessage 与应用程序背后的所有数学运算一起在我的 javascript 文件 (calculations.js) 中。 function() 部分位于脚本标签 . 中的 index.html 中
标签: jquery notifications cordova phonegap-build alerts