相当于 HTML 中的 include() [英] Equivalent of include() in HTML

查看:33
本文介绍了相当于 HTML 中的 include()的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想知道是否有一种方法可以仅使用 html 将一些 html 内容包含在另一个 html 中?

I was wondering wether there is a way to include some html content inside another html using only html?

PHP 的替代品

<?php include("file.php"); ?>

这可能吗?

这引起了一些混乱,我需要的是几乎是一个 html 标签",它具有将 html 文档包含在另一个文档中的功能.

This has brought up some confusion, what I needed was "almost an html tag" that had the functionality of including a html document in another.

推荐答案

不能完全由 HTML 完成.(不过,有 iframe,但我认为在这种情况下不符合条件.)

It cannot be done purely by HTML. (There are iframes, however, but I don't think that qualifies in this case.)

可以使用 JavaScript 来完成.您通过 Ajax 获取另一个文件,并将其内容放在当前页面的 HTML 元素中.

It can be done using JavaScript. You get the other file via Ajax, and place its contents inside an HTML element on the current page.

这篇关于相当于 HTML 中的 include()的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆