我是編碼方面的新手,所以我想從你們那裏得到一些幫助。我必須將每個單個文件(.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