I am new to all this programming and I am working with the IndexedDB API I have been analyzing my code for a long time and I can not find the error beforehand thanks for the help. The problem is the following button to delete each of the objects (which are called here but are more or less a record) does not work I have done some tests and nothing the delete function seems to work well but the data is not deleted here I leave the code
var bd;
function iniciar(){
zonadatos=document.getElementById("zonadatos");
boton=document.getElementById("grabar");
boton.addEventListener("click",agragarobjeto, false);
var solicitud=indexedDB.open("mibase6");
solicitud.onsuccess=function(e){
bd=e.target.result;
eliminartodo();
}
solicitud.onupgradeneeded=function(e){
bd=e.target.result;
bd.createObjectStore("gente", {keyPath: "iden", autoIncrement:true});
}
}
function agragarobjeto(){
var clave=document.getElementById("clave").value;
var titulo=document.getElementById("texto").value;
var Fecha=document.getElementById("fecha").value;
var transaccion=bd.transaction(["gente"], "readwrite");
var almacen=transaccion.objectStore("gente");
var agregar=almacen.add({clave: clave, titulo: titulo, Fecha: Fecha});
agregar.addEventListener("success", mostrar, false);
document.getElementById("clave").value=""
document.getElementById("texto").value=""
document.getElementById("fecha").value=""
}
function mostrar(){
zonadatos.innerHTML="";
var transaccion=bd.transaction(["gente"],"readonly");
var almacen=transaccion.objectStore("gente");
var cursor=almacen.openCursor();
cursor.addEventListener("success", mostrarDatos, false);
}
function mostrarDatos(e){
var cursor=e.target.result;
if(cursor){
zonadatos.innerHTML+='<p> <input type="number" style="width:60px" name="codigo" required="" id="codigo" value="' + cursor.value.clave + '" disabled> <input type="number" name="cfija" style="width:60px" required="" id="cfija" value="' + cursor.value.titulo + '" disabled> <input type="number" name="cfija" style="width:60px" required="" id="cvariable" value="' + cursor.value.Fecha + '" disabled> <button style="width:60px" type="button" onclick="eliminar(\'' +cursor.value.iden+ '\')">Eliminar</button> </p>' ;
cursor.continue();
hola.innerHTML+="hola";
}
}
function eliminar(valor){
var transaccion=bd.transaction(["gente"], "readwrite");
var almacen=transaccion.objectStore("gente");
var solicitud=almacen.delete(valor);
solicitud.addEventListener('success', mostrar, false);
solicitud.addEventListener('error', errores, false);
hola.innerHTML+=valor;
}
function eliminartodo(){
var transaccion=bd.transaction(["gente"], "readwrite");
var almacen=transaccion.objectStore("gente");
var solicitud=almacen.clear();
}
function errores(){
alert("Error:");
}
window.addEventListener("load", iniciar, false);