我有一个使用Prototype JS 框架的非常简单的网页微调器:
框架nav
:
Event.observe(
'doit',
'click',
function(){
parent.window.frames.cont.spinner.removeAttribute('style');
},
false);
框架cont
(这是 中的第一个元素<body>
):
<div id="spinner" style="display: none;"></div>
CSS:
#spinner {
width: 50px;
height: 50px;
position: fixed;
top: 50%;
left: 50%;
background: url(spinner.gif) transparent no-repeat center;
margin-left: -25px;
margin-top: -25px;
z-index: 2;
}
<div>
很简单,它是一个以框架为中心的固定位置cont
,并在浏览器加载页面时隐藏(也是为了避免在非 JS 浏览器中出现问题)。当用户单击nav
框架中的按钮时,该style
属性将被删除,并且用户会看到微调器,直到下一页接管。这在 Firefox 中工作得很好,但 IE 9 拒绝工作。这是我从他们的标准F12界面中发现的:
- 只有一个具有 ID 的元素
spinner
。 - 运行
parent.window.frames.cont.spinner.removeAttribute('style')
或parent.window.frames.cont.document.getElementById("spinner").removeAttribute("style")
在控制台选项卡中返回true
但会导致下一个元素被隐藏!这不会以任何明显的方式反映在HTML选项卡中 - 隐藏的元素仍然有style="display: block;"
.
我尝试使用 Prototype 的show(),它在 Firefox 中有效,但在 IE9 中无效...