【发布时间】:2014-05-25 07:36:22
【问题描述】:
我有页面项目/index.html
<html>
<head>
<title>Index</title>
<scripts...>
</head>
<body>
Hello
<div id="content"></div>
<button id="page1" value="page1"/>
<button id="page2" value="page2"/>
<button id="page3" value="page3"/>
<body>
</html>
JQuervy 文件 project/js/main.js 其中:
$(document).ready(function(){
$('button').click(function(){
var Id = this.id;
$("#content").load("pages/"+Id+".html #pageContent");
});
});
以及内容为project/pages/page1.html的页面
<html>
<head>
<title>Page1</title>
</head>
<body>
<div id="pageContent">
Page 1
</div>
<body>
</html>
----page2.html
...
<body>
<div id="pageContent">
Page 2
</div>
<body>
</html>
----page3.html
...
<body>
<div id="pageContent">
Page 3
</div>
<body>
</html>
一切正常,但在浏览器地址中我会得到当前页面的地址(例如 index.html/pages/page1.html 或 ingex.html/page1.html 或其他),不只是 index.html 如果这是posible with PHP可以举个例子吗?还创建的链接应该是活动的,点击它应该加载正确的页面。 谢谢大家!
【问题讨论】:
标签: javascript php jquery dynamic indexing