我有一段代码,我调用我的服务器获取一些值,如果该值不存在,则更新表。更新之后,我希望通过将单元格值设为粗体n秒来通知用户更新值的行。
var table=document.getElementById("employee_details");
var jsonString = JSON.stringify(array);
$.ajax({
url: '/server.php',
type: 'POST',
data: {"input":"calculate_charges",
data:jsonString},
cache: false,
success:function(response){
const arr3=JSON.parse(response);
for(var i=0; i<arr3.length; i++){
if(table.rows[i+1].cells.item(10).innerHTML!=arr3[i][2]){
table.rows[i+1].scrollIntoView({
behavior: 'smooth',
block: 'center'
});
table.rows[i+1].cells.item(10).innerHTML=arr3[i][2];
setTimeout(function(){
table.rows[i+1].cells.item(10).style.fontWeight = "500";
},7000);
setTimeout(function(){
table.rows[i+1].cells.item(10).style.fontWeight = "900";
},4000);
}
}
}
complete:function(){}
});
在执行代码时,我在控制台中不断遇到以下错误:
未捕获类型错误:无法读取未定义(正在读取)的属性
“细胞”)
而且单元格项不加粗。如何解决此问题?