0

我正在尝试使用带有PhoneGap的预填充数据库,所以我在这篇文章的帮助下尝试这个插件这是我试图运行的代码:

JS:

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:

<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>

我收到这些错误:

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)

有什么帮助吗?

4

1 回答 1

1

很可能你的报价:

var db = window.sqlitePlugin.openDatabase(“test.db”, “1.0”, “testsstst”, 20000);

对比

var db = window.sqlitePlugin.openDatabase("test.db", "1.0", "testsstst", 20000);
于 2012-11-10T17:35:42.687 回答