添加CSS菜单工具栏(带链接) [英] add a CSS menu toolbar (with links)

查看:63
本文介绍了添加CSS菜单工具栏(带链接)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好,


我在这个网站和其他网站上搜索了这个答案,但是在找到我正在寻找的答案的可能答案时遇到了麻烦。


我创建了一个网站在我的工作中,为工作人员提供表格,信息,培训等一站式服务。但是,网站是指实际上只是链接在一起的一堆html页面。


更糟糕的是,我在左侧有一个必须复制的导航菜单,在它的'整个,到每个HTML页面。每次我创建一个新页面时,我都要将它的代码添加到每个单独的html页面(最后一次计算我达到了20多页)。


我有一个CSS每个html页面都包含的文档,但我想知道我是否可以从每个页面中取出不变的代码并将其放入我的css文档中,以便每当有人访问不同的html页面时加载它。此外,如果可以,我将如何编码?我所知道的一切都是通过查看其他人的来源或w3cschools.com来自学。


如果用css不可能,还有其他办法吗?使用客户端代码进行操作?也许,javascript ??


感谢您的帮助...

Hi everybody,

I searched for this answer on this site and others, but had trouble sorting through the possible answers for the answer I''m looking for.

I created a "web site" at my job to give the staff a one stop shop for forms, info, training, etc. However, the "web site" is really just a bunch of html pages linked together.

To make matters worse, I have a navigation menu on the left-hand side that has to be copied, in it''s entirety, to every html page. Every time I create a new page, I have to add the code for it to every single html page (last count I was up to some 20+ pages).

I have a css document that is included for every html page, but I''m wondering if I can take the unchanging code from each page and put it in my css document so that it loads every time someone accesses a different html page. Also, if it can be done, how would I code it? Everything I know is pretty much self taught from looking at other people''s sources or for w3cschools.com.

If it''s not possible with css, is there another way to go about it using client side code? Perhaps, javascript??

Thanks for the help...

推荐答案

您无法通过CSS实现此目的,但是您可以用JavaScript做到这一点。只需在加载到页面中的外部JS文件中创建一个函数。在该函数中,只需响应。编写想要出现的HTML。


例如,

You cannot achieve this with CSS, but you could do it with JavaScript. Just create a function in an external JS file that is loaded into the page. In that function, simply response.write the HTML to want to appear.

For instance,

展开 | 选择 | Wrap | 行号


使用PHP。

Use PHP.

展开 | 选择 | Wrap | 行号


死亡,我的印象是你不能将PHP用于客户端应用程序。由于我没有办法做服务器端脚本,我认为PHP是不可能的。


另外,我创建了一个NavMenu.js文件,其中包含一个函数NavMenu()。对于标签中没有包含的每个标签,我在它周围加上单引号并在其后添加一个+符号以匹配Poe建议的内容。


但是,我是获取有关字符串常量的错误消息以及需要的onject。


在< head>中在html页面中,我有以下内容:
Death, I was under the impression that you couldn''t use PHP for client side apps. Since I don''t have the means to do server side scripting, I figured that PHP wasn''t possible.

Also, I created a NavMenu.js file with a function NavMenu() contained within. For every tag that wasn''t contained in a tag, I wrapped single quotes around it and added a + sign after it to match what Poe suggested.

However, I''m getting error messages about string constants and about an onject being required.

In the <head> of the html page, I have the following:
展开 | 选择 | Wrap | 行号


这篇关于添加CSS菜单工具栏(带链接)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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