这个IE错误的优秀解决方法是什么仍然允许我使用javascript在IE7或IE6中将HTML元素的显示样式设置为“继承”?
var el = document.getElementById('someElementID');
if (!el) return false;
try {
var displayValue = 'inherit';
//the next line throws exception in IE7 and IE6
// when displayValue = 'inherit'
// but not for other legit values like 'none', 'block', 'inline' or even ''
el.style['display'] = displayValue;
} catch (e) {
alert(e.message);
}
假设我不想要将visible: hidden
,position:absolute
设置在视野之外,或z-index
设置其他内容。