navigator.notification.alert()不是在科尔多瓦 - 2.0.0.js工作吗? [英] navigator.notification.alert() is not working in cordova-2.0.0.js?

查看:215
本文介绍了navigator.notification.alert()不是在科尔多瓦 - 2.0.0.js工作吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我是新来phonegap.In我的申请,我想显示alerts.For,我已经使用以下code,

I am new to phonegap.In my application i want display alerts.For that i have used following code,

navigator.notification.alert("PhoneGap is working");

但它不是working.My HTML总额code是,

But it is not working.My total html code is,

    <html>
  <head> 
  <script type="text/javascript" charset="utf-8" src="js/cordova-2.0.0.js"></script>
    <script>   

       function inti()
    {
     alert("inti");
     document.addEventListener("deviceready", onDeviceReady, true);

    }
     function onDeviceReady() {
          alert("on device ready!!!!");
     navigator.notification.alert("PhoneGap is working");
    } 
    </script>
  </head>
  <body onload="inti()">
    <p id="demo">System date</p>
    <input type="button" onclick="noti()" value="Date" />
  </body>
</html>

我得到不能调用方法'警惕'的不确定我得到这个错误。可任何一个指导我到超过走到这一步的问题。在此先感谢.....

i got Cannot call method 'alert' of undefined i got this error .can any one guide me to over come this issues. Thanks in Advance .....

推荐答案

您忘了加上cordova.js。尝试添加这一点。

You forgot to add the cordova.js . Try to add this.

&LT;脚本类型=文/ JavaScript的字符集=utf-8SRC =JS /科尔多瓦,2.0.0.js&GT;&LT; / SCRIPT&GT;

也添加

document.addEventListener(deviceready,onDeviceReady,真实); 上方 onDeviceReady()函数

这篇关于navigator.notification.alert()不是在科尔多瓦 - 2.0.0.js工作吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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