我是编码方面的新手,所以我想从你们那里得到一些帮助。我必须将每个单个文件(.php)放在一个.html/php文件中。将PHP/Html文件转换为html文件
现在,我得到这个代码:
<html>
<head>
<style type='text/css'>
span {
text-decoration:underline;
color:blue;
cursor:pointer;
}
</style>
<script>
// show the given page, hide the rest
function show(elementID) {
// try to find the requested page and alert if it's not found
var ele = document.getElementById(elementID);
if (!ele) {
alert("no such element");
return;
}
// get all pages, loop through them and hide them
var pages = document.getElementsByClassName('page');
for(var i = 0; i < pages.length; i++) {
pages[i].style.display = 'none';
}
// then show the requested page
ele.style.display = 'block';
}
</script>
</head>
<body>
<p>
Show page
<span onClick="show('Page1');">1</span>,
<span onClick="show('Page2');">2</span>,
<span onClick="show('Page3');">3</span>.
</p>
<div id="Page1" class="page" style="">
Content of page 1
</div>
<div id="Page2" class="page" style="display:none">
Content of page 2
</div>
<div id="Page3" class="page" style="display:none">
Content of page 3
</div>
</body>
所以我的问题是;我如何将文件放入'页面内容1/2/3'?
提前致谢!
这是JavaScript的不是PHP – Rizier123 2015-02-06 21:25:02
你为什么这样做呢? – 2015-02-06 21:25:48
您只需要更多''(“#includedContent”).load(“b.html”);'指向正确的页面并使用正确的DIV ID加载。 – developerwjk 2015-02-06 21:26:11