如何在 asp.net 中隐藏 iframe?
How to hide an iframe in asp.net?
我在 iframe 中显示 AJAX window。我希望用户能够单击位于 window 中的关闭按钮。起初这似乎有效,但是当我再次尝试显示 window 时,它不见了:
function closeme() {
if (parent.document.getElementById ("ifFundingSources")) { // clear the content of iframe if it's there
var iframe = parent.document.getElementById ('ifFundingSources');
iframe.parentNode.removeChild (iframe);
}
}
所以我想我需要隐藏 iframe 而不是删除它?如果是这样,我该怎么做?
编辑:我发现我可以这样隐藏它:
parent.document.getElementById ('ifFundingSources').style.display = "none";
可是,下次再打开window时,它还是隐藏了。我真正想做的就是用 window 上的按钮关闭 window。
您可以像这样使您的元素可见:
parent.document.getElementById ('ifFundingSources').style.display = "block";
每次打开 window 时都这样做。
我在 iframe 中显示 AJAX window。我希望用户能够单击位于 window 中的关闭按钮。起初这似乎有效,但是当我再次尝试显示 window 时,它不见了:
function closeme() {
if (parent.document.getElementById ("ifFundingSources")) { // clear the content of iframe if it's there
var iframe = parent.document.getElementById ('ifFundingSources');
iframe.parentNode.removeChild (iframe);
}
}
所以我想我需要隐藏 iframe 而不是删除它?如果是这样,我该怎么做?
编辑:我发现我可以这样隐藏它:
parent.document.getElementById ('ifFundingSources').style.display = "none";
可是,下次再打开window时,它还是隐藏了。我真正想做的就是用 window 上的按钮关闭 window。
您可以像这样使您的元素可见:
parent.document.getElementById ('ifFundingSources').style.display = "block";
每次打开 window 时都这样做。