簡體   English   中英

如何在div標簽中加載URL的內容?

[英]How to load the contents of a URL in a div tag?

我想在<div></div>打開另一個頁面,但是當我這樣做時,它會打開一個新頁面。

我使用iframe但不建議使用,它具有滾動條。

<div id="iframeLogin"><a href="first.php" target="_self">Link</a></div>

反正有沒有打開該div的頁面?

我希望它在訪問網站時將頁面自動加載到DIV上。

您可以使用jQuery的load方法。

$(function() {
    $("#iframeLogin").load("first.php");
});

請注意,如果first.php是完整的HTML頁面,則只希望加載頁面的一部分。

$("#iframeLogin").load("first.php #content");

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM