将 .html 包含在 .html 中
我使用该脚本
<!--#include virtual="dontate.html" -->
将一个 .html 文件包含到另一个 .html 文件中,但由于某种原因没有显示。
有什么理由吗?
我将使用 WAMP 和 LAMP。
谢谢 让
I used the script
<!--#include virtual="dontate.html" -->
to include a .html file into another .html file, but for some reason does not show up.
Any reason as to why?
I will be using WAMP and LAMP.
Thanks
Jean
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(7)
这是使用服务器端包含。您需要在您的服务器上进行设置。尽管“注释”语法具有误导性,但它确实与 HTML 无关。
This is using server-side includes. You need to set it up on your server. Despite the misleading "comment" syntax, it really has nothing to do with HTML.
如果服务器上有 php,您可以只包含 html 文件,如下所示
A lamp stack has php so you should be set.
但是,服务器可能未设置为通过 php 解释器运行该文件。您可以将其设置为解析文件的任何扩展名(正在执行包含操作的文件)或将其更改为已设置为解析的内容(home.html -> home.php)
if there's php on the server you can just include the html file like so
A lamp stack has php so you should be set.
However, the server may not be set up to run the file through php's interpreter. You can either set it to parse whatever the extension of the file is (being the file that is doing the including) or change it to something that is already set to be parsed (home.html -> home.php)
当您使用 wamp/lamp 时,我发现了一些可行的方法:
创建一个 .htaccess 文件并将以下内容放入其中
然后将您的 html 文件扩展名更改为 .shtml (包括要包含文件的文件)
所以
会变成
这应该可以工作
注意:
该文件与包含该文件的文件位于同一目录中,使用:
如果位于不同的目录中,则使用:
As your using wamp/lamp I found something that will work:
creating a .htaccess file and put the following in it
Then change your html file extensions to .shtml (including the file that is to include a file)
So
Would become
This should work
NOTE:
The file is in the same directory as the file that is including it use:
If it is in a different directory use:
也许问题是使用
虚拟
http://en.wikipedia.org/wiki/Server_Side_Includes
Perhaps the problem is the use of
virtual
http://en.wikipedia.org/wiki/Server_Side_Includes
如果没记错的话...我记得 IE 中的一些边界问题,但这对于原始集成来说应该足够了。
If memory serves... I recall some border issues in IE but that should be sufficient for a primitive integration.
根据 HTML 规范,无需服务器端脚本或服务器端包含即可实现此目的的唯一方法是通过 iframe。
* 注意粗体的“仅”。
As per the HTML spec, the only way to do this without server side scripting or server side includes is via iframes.
* note the bolded 'only'.
伙计们..这就是答案
// jsfile.js
****在 html 中包含 .js 文件****
就是这样
Guys..here is the answer
// jsfile.js
****include .js file in html****
thats it