【发布时间】:2010-12-01 18:15:03
【问题描述】:
我在 chrome 和 firefox 上进行了这项工作,基本上,当用户单击子图像时,它会通过将其显示属性从隐藏更改为显示来更改主图像。这是我的 img 元素。
<img id="lg1" src="http...
<img id="lg2" style="display:none" src="http...
<img id="lg3" style="display:none" src="http...
我的 js 看起来像这样:
$('#graph1').click(function() {
$("#lg1").css("display","inherit");
$("#lg2").css("display","none");
$("#lg3").css("display","none");
});
$('#graph2').click(function() {
$("#lg1").css("display","none");
$("#lg2").css("display","inherit");
$("#lg3").css("display","none");
});
$('#graph3').click(function() {
$("#lg1").css("display","none");
$("#lg2").css("display","none");
$("#lg3").css("display","inherit");
});
在 IE 中我得到这个错误:
Could not get the display property. Invalid argument.
我是否可以更改我的代码以使其适用于 Chrome、FF 和 IE?
谢谢!
【问题讨论】:
-
有什么方法可以将 Inherit 更改为其他内容吗?它继承自什么? IE。显示:块
-
为什么不能使用
display: inline(或display: block)? -
IE 8 最好,但 IE 7 会很好:)
标签: jquery internet-explorer google-chrome