javascript - 动态创建的表格单元格在 Firefox 32.0 中不显示

标签 javascript google-chrome firefox css-tables

我有一个游戏项目,其中使用了动态创建的表格。该表格及其单元格出现在 Chrome 中,但不在 Firefox 中。因此,为了检查它,我在另一个 html 文件中创建了一个单独的表格,看看是否存在问题无论我的代码如何,但表格单元格再次不会出现在 Firefox 上。我该如何解决这个问题?

var table=document.createElement('table');
table.style.width='300px';
table.style.height='300px';
table.style.border='1px solid black';
for(i=0;i<3;i++){
   var row=table.insertRow(i);
   for(j=0;j<3;j++){
       var cell= row.insertCell(j);
       cell.style.border='1px solid black';

   }

}  
document.body.appendChild(table); 

火狐:

enter image description here

Chrome :

enter image description here

最佳答案

我认为如果单元格中没有内容,某些浏览器不会显示单元格边框。尝试在单元格中至少填充空格

关于javascript - 动态创建的表格单元格在 Firefox 32.0 中不显示,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/26558921/

相关文章:

javascript - 火狐 PKCS11 WebExtesion "An unexpected error occurred"

javascript - Mongoose 不使用模型 save() 强制执行类型

javascript - Angular 12+ : Is there a Simple way to apply display mask/pipe for Reactive Form?

javascript - 谷歌浏览器如何启动桌面应用程序?

jquery - $(window).scroll(function() 在 Firefox 上不起作用?

javascript - XUL:滚动到顶部并重新加载页面

javascript - FastAPI 没有将 cookie 返回给 React 前端

javascript - 正则表达式关键字过滤

c# - 在 Chrome 中更新谷歌翻译 cookie 时出现问题

javascript - 安卓浏览器: avoid keyboard to hide when icon is pressed