gpt4 book ai didi

javascript - “Uncaught ReferenceError: cordova is not defined”

转载 作者:塔克拉玛干 更新时间:2023-11-02 09:15:55 26 4
gpt4 key购买 nike

我正在尝试通过 PhoneGap 在 iOS 上使用 Facebook slider 菜单。问题是我无法在 sqlite 中插入数据,单击保存按钮时出现此错误:

“未捕获的 ReferenceError:cordova 未定义”。

这是来源:

<!DOCTYPE html>
<html>
<head>
<title>Registration Form</title>
<link rel="stylesheet" type="text/css" href="../../css/index.css" />
<script type="text/javascript" src="../../js/SQLitePlugin.js"></script>
<script type="text/javascript" charset="utf-8">
// Wait for Cordova to load
//
document.addEventListener("deviceready", onDeviceReady, false);

function onDeviceReady() {
console.log("device ready");
}

function insert() {
console.log("Run1");
var db = window.sqlitePlugin.openDatabase({
name: "PHR.db"
});
db.transaction(function(tx) {
tx.executeSql(
'CREATE TABLE IF NOT EXISTS SignUp (firstname VARCHAR,lastname VARCHAR,email VARCHAR, password VARCHAR ,question1 VARCHAR, answer1 VARCHAR,question2 VARCHAR,answer2 VARCHAR, question3 VARCHAR,answer3 VARCHAR)'
);
});
db.transaction(function(tx) {
var fname = document.getElementById("fn").value;
var lname = document.getElementById("ln").value;
var emai = document.getElementById("em").value;
var passw = document.getElementById("pas").value;
var qus1 = document.getElementById("qs1").value;
var ans1 = document.getElementById("as1").value;
var qus2 = document.getElementById("qs2").value;
var ans2 = document.getElementById("as2").value;
var qus3 = document.getElementById("qs3").value;
var ans3 = document.getElementById("as3").value;
tx.executeSql(
'INSERT INTO SignUp (firstname,lastname,email, password ,question1 , answer1 ,question2 ,answer2 , question3,answer3) VALUES (?,?,?,?,?,?,?,?,?,?)', [
fname, lname, emai, passw, qus1, ans1, qus2, ans2, qus3,
ans3
]);
}, null);
});
}

</script>

最佳答案

你需要添加

<script type="text/javascript" src="cordova.js"></script>

在head标签中

关于javascript - “Uncaught ReferenceError: cordova is not defined”,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/24892403/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com