Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/javascript/385.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Javascript IndexDB Uncaught未能执行';交易';在';IDB数据库';_Javascript_Html_Transactions_Local Storage_Indexeddb - Fatal编程技术网

Javascript IndexDB Uncaught未能执行';交易';在';IDB数据库';

Javascript IndexDB Uncaught未能执行';交易';在';IDB数据库';,javascript,html,transactions,local-storage,indexeddb,Javascript,Html,Transactions,Local Storage,Indexeddb,我在一个登录/sigup系统中工作,我必须获取一些输入的值来注册它们,但我有一个问题 错误是: 未捕获的DomeException:未能对“IDBDatabase”执行“transaction”:未找到指定的对象存储之一 并出现在此代码行中:“var data=active.transaction([“usuarios”],“readwrite”) 有人能帮我吗?这是我的密码: var indexedDB = window.indexedDB || window.mozIndexedDB ||

我在一个登录/sigup系统中工作,我必须获取一些输入的值来注册它们,但我有一个问题

错误是: 未捕获的DomeException:未能对“IDBDatabase”执行“transaction”:未找到指定的对象存储之一

并出现在此代码行中:“var data=active.transaction([“usuarios”],“readwrite”)

有人能帮我吗?这是我的密码:

var indexedDB = window.indexedDB || window.mozIndexedDB || window.webkitIndexedDB || window.msIndexedDB;
var dataBase = null;

function startDB(){

  dataBase = indexedDB.open("objectDb", 1);


  dataBase.onupgradeneeded = function (e) {

    var active = dataBase.result;


    var objectDb = active.createObjectStore("usuarios", {keyPath: 'id', autoIncrement : true });


    objectDb.createIndex('index_nombre','nombre', {unique : false});
    objectDb.createIndex('index_user','usuario', {unique : true});
    objectDb.createIndex('index_correo','email', {unique : true});
    objectDb.createIndex('index_pass','pass', {unique : false});
  };

  dataBase.onsuccess = function (e) {
    alert("Base de datos cargada correctamente");

  };

  dataBase.onerror = function (e) {
    alert("Error cargando la base de datos");
  };
}

function add() {
  var active = dataBase.result;

  var data = active.transaction(["usuarios"], "readwrite");

  var objectDb = data.objectStore("usuarios");

  var request = objectDb.put({
    nombre: document.querySelector("#nombre").value,
    usuario: document.querySelector("#usuario").value,
    email: document.querySelector("#email").value,
    pass: documento.querySelector("#pass").value,
  });

  request.onerror = function (e) {
    alert(request.error.name + '\n\n' + request.error.message);
  };

  data.oncomplete = function (e) {
    document.querySelector("#nombre").value = "";
    document.querySelector("#usuario").value = "";
    document.querySelector("#email").value = "";
    document.querySelector("#pass").value = "";
    alert("Objeto agregado correctamente");
  };
}

这是我在indexedDB上的第一个项目,所以我非常高兴。很抱歉,如果这是

我找到了答案,这是var objectDb中的一个错误,我用小写字母输入了D,它成功了