iOS中使用PhoneGap HTML的自定义JavaScript提醒 [英] Custom JavaScript alerts in iOS using PhoneGap HTML

查看:81
本文介绍了iOS中使用PhoneGap HTML的自定义JavaScript提醒的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的应用程式有几个JS快讯,似乎总是显示网页名称。

My app has a couple of JS alerts and it seems to always display the page name like.

index.html

index.html

有一种方法可以将index.html更改为应用程序的名称或自定义文本。

Is there a way to change the index.html to my App's name or custom text.

示例:

My App // Which replaces .index.html
alert("I am an alert box!");


推荐答案

像Simon说的phonegap API。

Like Simon said check out the notifications it's part of the phonegap API.

这样调用 -

通知选项:

navigator.notification.confirm(
   "This is my Alert text!",
    callBackFunction, // Specify a function to be called 
    'Alert Title',
    ["Ok", "Awesome"]
);

function callBackFunction(b){
  if(b == 1){
    console.log("user said ok");
  }
  else {
    console.log("user said Awesome");
  }
}

一个简单的通知 -

A simple notification -

navigator.notification.alert(
    "This is my Alert text!",
    callBackFunctionB, // Specify a function to be called 
    'Alert Title',
    "OK"
);
function callBackFunctionB(){
    console.log('ok');
}

希望有所帮助!

这篇关于iOS中使用PhoneGap HTML的自定义JavaScript提醒的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆