首先,我想让大家知道我是一个绝对的初学者,所以请耐心等待。
我想知道如何将整个 html 页面放入 div 中。我试过$("#footballPlayers").html("footballplayers.html");
但它显示footballplayers.html
文本而不是整个页面。
索引.html:
<html>
<head>
<script type="text/javascript" src="jquery1.6.4min.js"></script>
<script type="text/javascript">
$(function(){
$("div#tabFootballPlayers").click(function(){
$("#footballPlayers").html("footballplayers.html");
$("#actionStars").html("");
$("#directors").html("");
});
});
$(function(){
$("div#tabActionStars").click(function(){
$("#actionStars").html("actionstars.html");
$("#footballPlayers").html("");
$("#directors").html("");
});
});
$(function(){
$("div#tabDirectors").click(function(){
$("#directors").html("directors.html");
$("#actionStars").html("");
$("#footballPlayers").html("");
});
});
</script>
<link rel="stylesheet" type="text/css" href="stylesheet.css">
</head>
<body>
<div>
<div id="tabFootballPlayers">Football Players</div>
<div id="footballPlayers"> </div>
<div id="tabActionStars">Action Stars</div>
<div id="actionStars"> </div>
<div id="tabDirectors">Directors</div>
<div id="directors"> </div>
</div>
</body>
</html>
使用负载
jQuery("#footballPlayers").load("footballplayers.html");
更多细节点击这里
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)