phonegap程序中的警报功能在android模拟器中不起作用

时间:2013-02-13 10:33:06

标签: android android-emulator cordova alert phonegap-plugins

now,the problem i am facing when i run the project in the LogCat
  

1 TAG-Trace TEXT-error打开跟踪文件:找不到这样的文件或目录(2)

当我点击定义了onclick函数的文本时,我没有得到任何错误状态

  

2 TAG-web控制台TEXT-uncaught Typeerror:无法在文件中调用undefined方法'alert':///android_assets/www.index.html:27

     

navigator.notification.alert(

我的编码是

    <html>
  <head>


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

    // Wait for Cordova to load
    //
    document.addEventListener("deviceready", onDeviceReady, false);

    // Cordova is ready
    //
    function onDeviceReady() {
        // Empty
    }

    // alert dialog dismissed
    function alertDismissed() {
        // do something
    }

    // Show a custom alertDismissed
    //
    function showAlert() {
        navigator.notification.alert(
            'You are the winner!',  // message
            alertDismissed,         // callback
            'Game Over',            // title
            'Done'                  // buttonName
        );
    }

    </script>
  </head>
  <body>
    <p><a href="#" onclick="showAlert(); return false;">Show Alert</a></p>
  </body>
</html>

in the case of the Accelerometer project nothing comes except whatever is given in the paragraph tag...where would i have committed mistake...i have no idea about it.

**i have tried with almost all the examples but the alert function does not function**


**i have tried both ways trying out with the example and then by copying all the files like the jar,cordova.js,xml and cordova folder**

now what should i do??? please help!!!

1 个答案:

答案 0 :(得分:0)

if (networkState == Connection.NONE)
{
  alert('No internet connection ');
 };