11-10 22:53:35.781: D/Cordovalog(20142): Uncaught TypeError: Cannot call method 'openDatabase' of undefined11-10 22:53:35.781: D/Cordovalog(20142): file:///androID_asset/www/Js/index.Js: line 8 : Uncaught TypeError: Cannot call method 'openDatabase' of undefined11-10 22:53:35.781: E/Web Console(20142): Uncaught TypeError: Cannot call method 'openDatabase' of undefined at file:///androID_asset/www/Js/index.Js:8
这是代码:
HTML
<HTML> <script type="text/JavaScript" src="Js/index.Js"></script> <head> <Meta http-equiv="Content-Type" content="text/HTML; charset=UTF-8" /> <Title>Hello World</Title> </head> <body onload="onLoad()"> <div > <h1>AAAA</h1> </div> <script type="text/JavaScript" src="cordova-2.2.0.Js"></script> </body></HTML>
Js:
function onLoad() { document.addEventListener("deviceready",onDeviceReady,false);}function onDeviceReady() { var db = window.sqlitePlugin.openDatabase("test.db","1.0","testsstst",20000);}
为什么是这样?
解决方法 您还应该在HTML中包含“sqlitePlugin.Js”,如下所示:<body>...<script type="text/JavaScript" src="cordova.Js"></script><script type="text/JavaScript" src="sqlitePlugin.Js"></script>...</body>总结
以上是内存溢出为你收集整理的PhoneGap中的Cordova-SQLitePlugin:未捕获的TypeError无法调用未定义的方法’opendatabase’全部内容,希望文章能够帮你解决PhoneGap中的Cordova-SQLitePlugin:未捕获的TypeError无法调用未定义的方法’opendatabase’所遇到的程序开发问题。
如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)