在PhoneGap的项目警报功能不会在Android模拟器工作

在PhoneGap的项目警报功能不会在Android模拟器工作

本文介绍了在PhoneGap的项目警报功能不会在Android模拟器工作的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

 现在,我所面临的问题,当我运行该项目在LogCat中

when i click on the text for which onclick function is defined i don't get anything the error states

my coding is

    <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!!!
解决方案
if (networkState == Connection.NONE)
{
  alert('No internet connection ');
 };

这篇关于在PhoneGap的项目警报功能不会在Android模拟器工作的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

09-13 00:47