html - Style.display ="inline"以不需要的方式显示表格行,有什么办法可以解决吗?

标签 html css inline css-tables

我正在使用单选按钮,当用户点击它时,表格中的一行将显示,我使用 style="display:none;" 来隐藏它,下面的代码Javascript 来显示它:

document.getElementById("testId").style.display = "inline";

问题是它的显示方式,因为我刚刚注册,所以我无法上传它的显示方式的图片,但我会尽可能多地展示它。

----------------------------------------------------------------
this is before 
----------------------------------------------------------------
this is test test test test | this is the row
----------------------------------------------------------------

******************

--------------------------------------------------
this is after showing it with inline
--------------------------------------------------
this | this is the row
 is  |
test |
test |
test |
test |

我还注意到这种显示此行的方式只发生在 IE 以外的浏览器中! 有什么办法可以解决这个问题吗?

最佳答案

I used style="display:none;" to hide it and the code below in java script to show it

document.getElementById("testId").style.display = "inline";

inline 不是表格行的正确初始显示值 – 当然是 table-row

但由于旧的 IE 不能正确理解这一点,你应该将它设置为一个空字符串,

document.getElementById("testId").style.display = "";

– 这将使浏览器简单地将显示样式重置为浏览器认为是表格行的正确默认显示值。

关于html - Style.display ="inline"以不需要的方式显示表格行,有什么办法可以解决吗?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/19652067/

相关文章:

php - 从 Web 表单上的 50 多个复选框获取输入

javascript - sinatra + angular.js + 加载模板

当内容高度太大时 CSS 边距不起作用

javascript - 图像之间连续淡入淡出和旋转

html - Outer Div 内部有内联 block 元素时内容的宽度

Android - 如何使用 Html.ImageGetter 以在编辑文本或 TextView 中显示图像数量

javascript - 编辑记录时显示所选值

jQuery 删除一个类

c++ - Visual C++ 的这种奇怪的内联行为是否符合预期?

c++ - 使用 -O3 编译时将函数标记为内联?