每当我使用 .load() 函数将页面加载到 div 时,它只返回文本而不是背景图像或页面中的任何图像。
索引.html
<html>
<title> web page </title>
<body>
<div id="Content" >
</div>
<script type="text/javascript" src="jquery.js" ></script>
<script type="text/javascript" src="jquery.min.js" ></script>
</body
</html>
page.html (将加载到 div id="Content" 的页面)
<html>
<title> web page </title>
<body>
<div>
<h1> WELCOME TO THIS LOADED PAGE </h1>
<img src="image.jpg" />
</div>
<script type="text/javascript" src="jquery.js" ></script>
<script type="text/javascript" src="jquery.min.js" ></script>
</body
</html>
jQuery.js
$(document).ready(function(){
$('#content').load('page.html');
});
它最终只显示WELCOME TO THIS LOADED PAGE,但不显示page.html中包含的图像。
谢谢你。