Reputation: 1371
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");
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 .....
Upvotes: 0
Views: 5357
Reputation: 62419
Check your Cordova Jar file version and you have written in <script>
. May it'll be different.
Upvotes: 0
Reputation: 79
navigator.notification.alert( "Yes", callBackFunctionB, // Specify a function to be called 'Heading', "OK" );
Upvotes: -1
Reputation: 56935
You forgot to add the cordova.js . Try to add this.
<script type="text/javascript" charset="utf-8" src="js/cordova-2.0.0.js"></script>
also add
document.addEventListener("deviceready", onDeviceReady, true);
above onDeviceReady()
function.
Upvotes: 4