当应用程序在设备上运行时,如何调用Onload函数? 在浏览器这一行......运行良好,但是当我在Android设备上运行我的应用程序onLoad函数没有调用时,我可以做onload调用吗?
我试图在"<body onload="onLoad">... </body>"代码中的标签中添加此代码:
<head> // .... <script> document.addEventListener('deviceready', onLoad); </script> <script type="text/javascript" src="js/help.js"></script> <script type="text/javascript" src="cordova.js"></script> </head> <body> </body>help.js:
function onLoad() { window.alert("onLoad"); }onLoad-是我在help.js文件中写的函数,我在script标签中添加了这个文件。 在我的Android设备上没有任何警报没有显示。
How can I call to Onload function when the app is run on device? On browser this line ... working well, but when I run my app on android device the onLoad function not calling, whan can I do to make the onload call?
I have tried to add this code in the tag inside of the "<body onload="onLoad">... </body>" code :
<head> // .... <script> document.addEventListener('deviceready', onLoad); </script> <script type="text/javascript" src="js/help.js"></script> <script type="text/javascript" src="cordova.js"></script> </head> <body> </body>help.js:
function onLoad() { window.alert("onLoad"); }onLoad- is the function that I write in my help.js file, and I add this file inside script tag. On my android device nothing the alert not show.
最满意答案
window.alert在浏览器中工作,而不是在android中。
你应该使用这里解释的notification.alert
window.alert works in browser and not in android.
you should use notification.alert as explained here
更多推荐
发布评论