navigator.notification.alert()不是在科尔多瓦 - 2.0.0.js工作吗?是在、科尔、多瓦、工作

2023-09-07 04:54:37 作者:暗恋未遂心先死,

我是新来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()函数