我正在尝试弄清楚如何在加载网站时将我的一个子页面加载到 div 标记中。
我有一个像这样的 div:
<div id="content-main">
</div>
重要的是我只想在加载主 index.html 时加载某些子 html 文档。
最佳答案
你可以在加载 html 时使用 javascript onload 函数,它非常容易使用,比如
var body = document.querySelector('body');
body.onload = function(){
//do some thing
}
关于javascript - 加载主 index.html 时加载到 div 中的某些 html 子页面,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/31582975/