Javascript Phonegap deviceready事件未在设备上激发
我正在开发一个移动应用程序,但是我在phonegap上遇到了一些问题。我是begginer,但当我阅读文章时,我必须简单地插入这一行来处理phonegap的功能Javascript Phonegap deviceready事件未在设备上激发,javascript,jquery,cordova,phonegap-build,Javascript,Jquery,Cordova,Phonegap Build,我正在开发一个移动应用程序,但是我在phonegap上遇到了一些问题。我是begginer,但当我阅读文章时,我必须简单地插入这一行来处理phonegap的功能 <script src='phonegap.js'></script> 像这样: document.addEventListener('deviceready', ondeviceready); function ondeviceready(){ alert('wooohooo'); } $(docu
<script src='phonegap.js'></script>
像这样:
document.addEventListener('deviceready', ondeviceready);
function ondeviceready(){
alert('wooohooo');
}
$(document).ready(function(){
document.addEventListener('deviceready', ondeviceready);
});
function ondeviceready(){
alert('wooohooo');
}
$(document).on('deviceready',ondeviceready);
function ondeviceready(){
alert('wooohooo');
}
就像这样:
document.addEventListener('deviceready', ondeviceready);
function ondeviceready(){
alert('wooohooo');
}
$(document).ready(function(){
document.addEventListener('deviceready', ondeviceready);
});
function ondeviceready(){
alert('wooohooo');
}
$(document).on('deviceready',ondeviceready);
function ondeviceready(){
alert('wooohooo');
}
有人能帮我吗
(我在三星galaxy s和三星galaxy note 2上测试了该应用程序)像这样试试
document.addEventListener("deviceready", function(){
alert('hello');
});
或者尝试将代码放在以下方法中
this.init = function(){
}
你还在使用phonegap.js吗下载最新版本的phonegap并使用cordova.js最后,我不知道为什么,但它对我很有用
function ondeviceready(){...}
document.addEventListener("deviceready", ondeviceready);
因为phonegap构建网站说,除了下载文件,只需使用:或者我误解了文档?我也尝试过从那里构建应用程序,但这无法正常工作。在IDE中构建代码,然后运行。并使用corodova.js而不是phonegap.jsIm,使用升华文本:(使用sublime文本编辑器无法测试应用程序,请使用eclipe(适用于android)或xcode(适用于ios)我知道我不必使用IDE!我有一个设备可以测试应用程序,但我认为phonegap.js在编译时没有连接到我的应用程序。只是澄清一下。这是有效的,因为你在使用它之后定义了函数。在这里,你将函数定义放在文档上方.addEventListener(…)调用。