首页
学习
活动
专区
圈层
工具
发布
首页
学习
活动
专区
圈层
工具
MCP广场
社区首页 >问答首页 >尝试使用Cordova-SQLitePlugin时的SyntaxError

尝试使用Cordova-SQLitePlugin时的SyntaxError
EN

Stack Overflow用户
提问于 2012-11-10 17:27:44
回答 1查看 1.3K关注 0票数 0

我正在尝试使用带有PhoneGap的预填充DB,所以我在THIS文章的帮助下尝试使用THIS插件。下面是我要运行的代码:

JS:

代码语言:javascript
运行
复制
function onLoad() {
    document.addEventListener("deviceready", onDeviceReady, false);
}

// Cordova is loaded and it is now safe to make calls Cordova methods
//
function onDeviceReady() {
    var db = window.sqlitePlugin.openDatabase(“test.db”, “1.0”, “testsstst”, 20000);

}

HTML:

代码语言:javascript
运行
复制
<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 class="app">
            <h1>AAAA</h1>
        </div>
        <script type="text/javascript" src="cordova-2.2.0.js"></script>

    </body>
</html>

我得到以下错误:

代码语言:javascript
运行
复制
11-10 11:19:27.961: D/CordovaLog(9264): Uncaught SyntaxError: Unexpected token ILLEGAL
11-10 11:19:27.965: D/CordovaLog(9264): file:///android_asset/www/js/index.js: Line 8 : Uncaught SyntaxError: Unexpected token ILLEGAL
11-10 11:19:27.965: E/Web Console(9264): Uncaught SyntaxError: Unexpected token ILLEGAL at file:///android_asset/www/js/index.js:8
11-10 11:19:28.976: D/CordovaLog(9264): Uncaught ReferenceError: onLoad is not defined
11-10 11:19:28.976: D/CordovaLog(9264): file:///android_asset/www/index.html: Line 27 : Uncaught ReferenceError: onLoad is not defined
11-10 11:19:28.976: E/Web Console(9264): Uncaught ReferenceError: onLoad is not defined at file:///android_asset/www/index.html:27
11-10 11:19:28.996: D/Cordova(9264): onPageFinished(file:///android_asset/www/index.html)

有什么帮助吗?

EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2012-11-11 01:35:43

最有可能的是你的语录:

代码语言:javascript
运行
复制
var db = window.sqlitePlugin.openDatabase(“test.db”, “1.0”, “testsstst”, 20000);

代码语言:javascript
运行
复制
var db = window.sqlitePlugin.openDatabase("test.db", "1.0", "testsstst", 20000);
票数 1
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/13320850

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档