頁頭頁尾加載方法
阿新 • • 發佈:2017-11-11
pla ready arc ati pan fun psu images -c
1.PHP+JQ+HTML
HTML
<div id="header"> <img src="loading.gif" alt=""> //等待的gif圖 </div> <div id="main"> <h3>首頁</h3> <p>Lorem ipsum dolor sit amet, consectetur adipisicing elit. Accusamus amet architecto asperiores culpa error, maiores natus neque officiis perspiciatis repellendus sed sunt. Eius eos molestias nihil placeat possimus sit veniam.</p> </div>
PHP
header("Content-Type:text/html;charset=UTF-8"); //設置響應頭 ?> <hr> //輸出HTML代碼 <p id="copyright">版權所有? 2017-10-11</p>
JQ
<script> $(document).ready(fn)/*頁面加載完成後實現*/ $(function(){ /*頁面加載完成後實現*/ $("#header").load("footer.php") }) </script>
輸出效果:
頁頭頁尾加載方法