假设我有以下html页面。
<html>
<head>
<link type="text/css" rel="Stylesheet" href="css/some.css" />
</head>
<body>
<input type="button" value="test" id="btnTest" name="btnTest"/>
<!--Script Section start-->
<script type="text/javascript" src="js/jquery/jquery-1.4.1.js"></script>
<script type="text/javascript">
function someFunction()
{
alert("hi");
}
</script>
<!--Script Section end-->
</body>
</html>
当我点击该页面的顶层菜单时,我希望在没有iframe帮助的情况下将整个页面加载到另一个页面中。
答案 0 :(得分:3)
当两个页面都在同一台服务器上时,这是可能的。你应该看一下jQuery的.load()函数:http://api.jquery.com/load/
您还可以通过在load语句中使用选择器来仅包含页面的某些部分,如此
$('#result').load('ajax/test.html div:first');