php - 在 html 文件中包含 html 电子邮件

标签 php jquery html

我想在我的 html 页面中显示 html 电子邮件

这是我的简化版 index.html

<!DOCTYPE html>
 <html class="no-js" lang="">
 <head></head>
 <body>
    <div id='email_goes_here'></div>
 </body>
 </html>

这就是我的 email.html 的开始

<!doctype html>
<html xmlns="http://www.w3.org/1999/xhtml" xmlns:v="urn:schemas-microsoft-com:vml" xmlns:o="urn:schemas-microsoft-com:office:office">
    <head>
        ....

我想输入 email.html 中的代码里面div#email_goes_here来自index.html .

仅将代码复制并粘贴到 div 中是否有效?我不确定 2 <!DOCTYPE html> 的 html 是否有效和 2 <html>标签。如果它无效,我如何在另一个 html 页面中显示该 html 页面?任何使用 PHP 或 jQuery 的方法都可以。

我一直在寻找这个问题,但没有找到任何东西。我只找到了如何在另一个html文件中包含一些html内容的问题,但没有找到如何包含完整的html页面的问题。以下是我找到的链接:

Include another HTML file in a HTML file

view html page inside another html

How do I load an HTML page in a <div> using JavaScript?

How to include an HTML page into another HTML page without frame/iframe?

最佳答案

最简单的方法是使用 <iframe> .

如果您使用srcdoc属性,您将避免设置任何外部 html 文档。

工作示例:

<iframe srcdoc="
<html>
<head>
<style>p{color: rgb(255,0,0);}</style>
</head>

<body>
<p>This is an example of an <code>iframe</code> which uses the <code>srcdoc</code> attribute.</p>
</body>
</html>
">
</iframe>


进一步阅读: https://developer.mozilla.org/en/docs/Web/HTML/Element/iframe

关于php - 在 html 文件中包含 html 电子邮件,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/42386307/

相关文章:

jQuery .get 错误响应函数?

javascript - 图像裁剪器不适用于外部图像

html - 深度定制 Wordpress 主题 CSS

html - 在图像上放置文本(已尝试此处的其他建议但没有用)

javascript - 用javascript中的mysql数据库中的数据填充下拉列表

php - 在 codeigniter 中搜索某些条件

php - 从带引号的标签和值的格式化分隔字符串中获取值

php - 如何从mysql查询中检索特定格式的数据?

jquery - 改变输入值

javascript - 如何从鼠标更改为触摸?