vinsertBtn.onclick = function(){
insertData();
}
function insertData(){
var vimages = document.getElementById("cfile");
var thefile = vimages.files[0];
vfinishicon.style.display = 'none';
// Create a root reference
var storageRef = firebase.storage().ref("productImages/"+thefile.name);
var idxDot = thefile.name.lastIndexOf(".") + 1;
var extFile = thefile.namethefile.name.substr(idxDot, thefile.name.length).toLowerCase();
if (extFile !== "jpg" && extFile !== "jpeg" && extFile!=="png"){
$("#resultID").attr("class","alert alert-danger");
$("#resultID").text("only jpeg or png are accepted.");
vresult.focus();
return;
}
使用此代码a会出现此错误:
insertproduct.html:269未捕获的TypeError:无法读取属性“名称” 未定义 在insertData(insertproduct.html:269) 在HTMLButtonElement.vinsertBtn.onclick(insertproduct.html:261)