为什么jquery hide在IE7中不能正常工作?
我有一个包含不同 div 主体的弹出窗口,其中一个根据按下的按钮显示。 下面的函数在 IE7 中工作:
function openPopup(popupDiv){
//The popup is a div with id name popupDiv
//It contains several bodies such as
//alertPopupDiv, uploadPopupDiv, removePopupDiv
//The div id name of the body to show is passed to the function
//First hide all the bodies
$("#popupDiv div[id$=PopupDiv]").each(function (i)
{this.style.visibility='hidden';});
//Now show the relevant div
var div = document.getElementById(popupDiv);
if(div != null)
{div.style.visibility = 'visible';}
//Now call the function to load the popup itself
loadPopup();
}
但理想情况下我想使用更简单的:
function openPopup(popupDiv){
$("div[id$=PopupDiv]").hide();
$(popupDiv).show();
loadPopup();
}
这在 Firefox 和 IE8 中很好,但在 IE7 中不起作用(它第一次被调用时有效,但如果该函数被调用 open使用新容器的弹出窗口,无法正确渲染。
I have a popup containing different div bodies, one which shows according to button pressed.
The function below works in IE7:
function openPopup(popupDiv){
//The popup is a div with id name popupDiv
//It contains several bodies such as
//alertPopupDiv, uploadPopupDiv, removePopupDiv
//The div id name of the body to show is passed to the function
//First hide all the bodies
$("#popupDiv div[id$=PopupDiv]").each(function (i)
{this.style.visibility='hidden';});
//Now show the relevant div
var div = document.getElementById(popupDiv);
if(div != null)
{div.style.visibility = 'visible';}
//Now call the function to load the popup itself
loadPopup();
}
But ideally I would have like to use the much simpler:
function openPopup(popupDiv){
$("div[id$=PopupDiv]").hide();
$(popupDiv).show();
loadPopup();
}
Which is fine in Firefox and IE8, but doesn't work in IE7 (it works first time it is called, but if the function is calls open the popup with a new container, it fails to render properly.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
使用内联或无属性
use inline or none property