3
我有一個彈出窗口包含不同的div body,其中一個按鈕按下顯示。 下面的函數工作在IE7:爲什麼jQuery隱藏在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中不工作(它的作品第一次被調用,但如果功能調用打開彈出一個新的容器,它無法正確渲染。
感謝您的選擇。 '可見'確實和'內聯'一樣工作,但仍不清楚爲什麼第二個函數中的簡單隱藏/顯示在IE7中不起作用 – DanB 2011-01-31 12:22:05