用模版引擎的继承,如何做到当前页面的连接更换背景颜色;

WBOY
Release: 2016-06-23 13:37:49
Original
1377 people have browsed it

基模版base.htm; 其中包含导航栏等;



1.htm 2.htm 3.htm是栏目,  都继承  base.htm;

如何做到,点击导航3.htm的连接时,跳转到3.htm页面,在3.htm中, 导航中的 3栏目 背景颜色改变;


1.方法: 用JS,可以做到,就是取得当前网址,然后比对导航栏的连接,相同的则改变其背景颜色;
2.方法: 把每个栏目都变成一个模块, 每次加载时,覆盖对应模块,这个十分麻烦;
3.求正常的方法,我看别人的程序,没有使用上面的方法,也没用AJAX,请问是如何做到的.谢谢




回复讨论(解决方案)

如果你的做法是这样,那你直接把3.html的相关导航做成激活的不就完事了?

换一下 css 文件

source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!