有没有办法在所有的HTML页面上都有相同的菜单 [英] Is there any way to have same menu on all html pages

查看:132
本文介绍了有没有办法在所有的HTML页面上都有相同的菜单的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

对于所有知识渊博的开发人员来说,这可能看起来很愚蠢,但我需要问这个。

我知道asp.net中有一种方法可以在所有页面中显示相同的内容,即母版页

可以在飞机html中实现。如果是,那怎么样?



谢谢大家。

It might look silly question to you all well knowledge developers, but I need to ask this.
I know there is a way in asp.net to display same contents in all pages i.e Master Page
Can it be implemented in plane html. If yes, then how?

Thanks all.

推荐答案

使用纯HTML?不是。所有HTML文件彼此独立,仅通过导航(通过锚点,基本上相关)。没有包含或导入功能。



原因是HTML主要面向在Web上使用(即使它可以是用于与Web无关的文档),每个包含的文件都需要单独的HTTP请求和响应,这种通信的一些开销可能会破坏这些包含的有用效果。这是当包含外部CSS或JavaScript文件时真正发生的事情。



但是使用任何服务器端技术都可以轻松实现文件重用的效果。由于你不打算使用任何,我不打算给你提供相关的信息,但只会提到最简单的一个:服务器端包括http://en.wikipedia.org/wiki/Server_Side_Includes [ ^ ]。



-SA
With pure HTML? No. All HTML files are independent from each other, only related by navigation (through anchors, basically). There are no "include" or "import" features.

The reason for that is that HTML is primarily oriented for the use on the Web (even though it can be used for documents unrelated to the Web), and each included file would require a separate HTTP request and response, with some overhead for this communication which can defeat the useful effect of such includes. This is what really happens when external CSS or JavaScript files are included.

But the effect of file reuse can easily be achieved with any of the server-side technology. As you are not going to use any, I'm not going to give you information on it, but will just mention the simplest one: server-side includes: http://en.wikipedia.org/wiki/Server_Side_Includes[^].

—SA


这篇关于有没有办法在所有的HTML页面上都有相同的菜单的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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