【发布时间】:2013-12-03 03:43:41
【问题描述】:
我想将一些页面包含到一个 div 中,但我不知道如何。有问题的代码如下
我想在内容 div 中包含一个页面,所以当我在导航栏中单击联系人时,contact.php 需要加载到 index.php 的内容 div 中,当我在导航栏中单击关于我们时,关于.php 页面包含在 index.php 的内容 div 中..
<html>
<body>
<div id="navbar">
<ul>
<li>
home
</li>
<li>
about us
</li>
<li>
contact
</li>
<ul>
<div id="content">
<!--so when the user clicks on contact us there needs
to be an include in this div wich includes the contactus.php page.
-->
<?php include 'contactus.php'; ?>
</div>
</body>
</html>
【问题讨论】:
-
不,我没有,但没有使用包含更好的方法来用另一个页面的内容填充 div?
-
你有什么尝试吗?这将涉及到一些 AJAX 函数的使用。
-
你必须使用 Ajax,见:stackoverflow.com/questions/9963799/…