Javascript 插件未从控制台运行:无法执行';警报';未定义的
我已经为cordova安装了diaglog插件。当我运行它时,我得到一个错误,上面写着“无法调用未定义的'alert'方法” 当我从控制台执行相同的函数时,它运行得非常好 这是我的index.html文件:Javascript 插件未从控制台运行:无法执行';警报';未定义的,javascript,cordova,Javascript,Cordova,我已经为cordova安装了diaglog插件。当我运行它时,我得到一个错误,上面写着“无法调用未定义的'alert'方法” 当我从控制台执行相同的函数时,它运行得非常好 这是我的index.html文件: <html> <head> <script type="text/javascript" src="jquery.js"></script> <script type="text/javascript" src="co
<html>
<head>
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript" src="cordova.js"></script>
<script type="text/javascript" src="js/index.js"></script>
<script type="text/javascript" src="plugins/org.apache.cordova.dialogs/www/notification.js"></script>
<script type="text/javascript">
$( document ).ready(function() {
navigator.notification.alert( <--------------------- here!!
'You are the winner!', // message
function(){
}, // callback
'Game Over', // title
'Done' // buttonName
);
});
</script>
<LINK rel="stylesheet" href="style.css" type="text/css">
</head>
<body >
<div> hello world</div>
</body>
</html>
$(文档).ready(函数(){
navigator.notification.alert(您需要等待
插件未在中初始化
$(document.ready()
文档加载->文档准备->cordova开始初始化->deviceready您在哪里定义导航器/通知?非常感谢。我一读到第一行就马上明白了。再次感谢。