首先讓我說我完全接受另一種方法的想法。在iframe中只顯示一個div(javascript,jQuery ...)
我和iframe這樣:
<div id="testloadlogin">
<iframe src="../security/login.aspx" width="400" height="500"
scrolling="auto" frameborder="1">
[Your user agent does not support frames or is currently configured
not to display frames. However, you may visit
<a href="../security/login.aspx">the related document.</a>]
</iframe>
</div>
正在加載的頁面與IFRAME有一個div叫loginInnerBox。我只想顯示loginInnerBox及其中的所有內容。
有關如何做到這一點的任何想法?我正在考慮使用jquery或某種類型的javascript來刪除頁面加載的iframe上的所有內容,但不知道如何訪問該頁面,但...
只是爲了清楚我希望我的頁面上的所有內容iframe保持不變。我想要相當於說。$('testloadlogin')。load('../security/login.aspx'#loginInnerBox)它只會得到loginInnerBox的html並將它放在testloadlogin div中。不過,我需要從iframe支持的其他頁面進行後端處理,但不需要Jquery加載。
在iframe中加載頁面的標記是
<body>
<div>
</div>.......
<div class="AspNet-Login" id="ctl00_CLPMainContent_Login1">
<div id="loginInnerBox">
<div id="loginCreds">
<table>
</table>
</div>
</div>
</div>
<div>
</div>....
</body>
你需要更多的信息?
我想這一點,它沒有任何效果:
<div class="ui-corner-all" id="RefRes">
<div id="testloadlogin">
<iframe onload="javascript:loadlogin()" id="loginiframe" src="../security/login.aspx"
scrolling="auto" frameborder="1">
[Your user agent does not support frames or is currently configured
not to display frames. However, you may visit
<a href="../security/login.aspx">the related document.</a>]
</iframe>
</div>
</div>
<script type="text/javascript">
function loadlogin() {
$('<body>*', this.contentWindow.document).not('#ctl00_CLPMainContent_Login1').hide();
}
</script>
我不明白。 「只顯示框」是什麼意思?你想要與其他內容發生什麼?關於iframe之外的內容呢? – 2010-11-03 12:10:37
對不起。內容的其餘內容我想要消失的iframe。我希望保持完整的iframe內容。 – kralco626 2010-11-03 12:11:45
這取決於iframe中加載頁面的標記,如何操作,所以請顯示標記。 – 2010-11-03 12:26:58