[英]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.