gpt4 book ai didi

HTML - 如何包含外部 html 页面

转载 作者:太空宇宙 更新时间:2023-11-04 14:12:50 25 4
gpt4 key购买 nike

我正在开发一个网站,我有一个包含一些内容的 html 页面,还在同一页面中制作了一个注册模式,但是代码越来越长,我只想知道我是否保留注册代码模态在另一个扩展名为 .html/.htm 的文件中,单击按钮时模态显示在同一页面上,而不是被重定向到另一个页面,就像它在主页上显示的那样。我不希望家庭内容被打碎,只希望模式显示在上面。

最佳答案

您可以使用 jquery 来完成此任务:

只需创建一个新文件“modal.html”并在那里编写弹出代码。

<script src="//code.jquery.com/jquery-1.10.2.js"></script>
<script>
$(function(){
$("#header").load("modal.html");
});
</script>
</head>

<body>
<div id="header"></div>
<!-- other code -->
</body>

关于HTML - 如何包含外部 html 页面,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/37652447/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com