473,387 Members | 1,516 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

SSI nav bar but page name cell a different colour?

My website formatting knowledge is mostly HTML; I know hardly any
Javascript. Recently I created a site with a nav bar in table format across
the top of the page, and I made the background colour of the cell with the
name of the page that the reader was on a different shade, like this:

Home | This | That | Other | Etc.

If you were on "Other" page, for example, the background colour of the
"Other" cell was a different shade from the others. I created this by
altering the code on each page.

This site was hosted with a web host that has SSI, and the nav bar became
the same file for every page, so we lost this minor navigation aid. Someone
mentioned that the same effect (a different colour or shade for the cell
with the page name) could be achieved with Javascript, but since I don't
know Javascript and we'd run out of time, we didn't do it.

Now I'd like to have this different colour for the page name cell at another
site using SSI for the nav bar. Is this possible? If so, how? To make it
even more fun, some of the page names are entry points to another section of
the site. If I can make "Other" a different colour, for example, I'd also
like to make pages in the "Other" folder have this same feature so that
readers know that they're in the "Other" section of the site. Or is this too
much?

Thanks for any help. Please keep in mind that I don't speak the language
very well.

Lois

Jul 20 '05 #1
2 2465
Yep
"Lois" <th************@excite.com> wrote in message news:<5J****************@fe01.atl2.webusenet.com>. ..
Recently I created a site with a nav bar in table format across
the top of the page
I don't think that you need a table here, it merely adds more code
while a DIV filled with A elements and a bit of CSS would do an
excellent job :-)
If you were on "Other" page, for example, the background colour of the
"Other" cell was a different shade from the others. I created this by
altering the code on each page. Now I'd like to have this different colour for the page name cell at another
site using SSI for the nav bar. even more fun, some of the page names are entry points to another section of
the site. If I can make "Other" a different colour, for example, I'd also
like to make pages in the "Other" folder have this same feature so that
readers know that they're in the "Other" section of the site.


A simple technique to achieve both goals would be to grab the
querystring and parse it; you can easily retrieve the folder part (the
section) to make the desired changes in your page, and the file name
part to update the corresponding menu item.

<div id="myMenu">
<a href="home.html">Home</a>
<a href="that.html">That</a>
<a href="this.html">This</a>
<a href="other.html">Other</a>
<a href="nav.html">Test</a>
</div>

<style type="text/css">
#myMenu a { background:green; color:white; padding:2px 15px}
#myMenu a:hover { background:yellow; color:orange }
</style>

<script type="text/javascript">
(function(){
var d=document;
if(d.getElementById&&d.getElementsByTagName){
var pageParts=/\/([^\/]+)\/([^\/]+\.html?)$/.exec(location.href),
a=d.getElementById("myMenu").getElementsByTagName( "a");
//Update the link
for(var ii=0; ii<a.length; ii++){
if(a[ii].href.indexOf(pageParts[2])!=-1){
with (a[ii].style){ background="whitesmoke"; color="pink"; }
break;
}
}
//Update the section parts knowing that...
alert("You're in section : " + pageParts[1]) ;
}
})()
</script>
The function here just creates a specific scope, so that you can
safely put the js code in a js include, for instance in your SSI -
just update the id of the menu container, and maybe the extensions and
additional querystrings in the regexp.
HTH
Yep.
Jul 20 '05 #2
Lois:
: > Recently I created a site with a nav bar in table format across
: > the top of the page

Yep:
: I don't think that you need a table here, it merely adds more code
: while a DIV filled with A elements and a bit of CSS would do an
: excellent job :-)

Yeah, I know. It took a couple of years for me to be comfortable with HTML
and to be able to do tables fairly fast. When I finally got to that point, I
started reading that using tables for layout was passe, and that CSS was the
latest thing. Such is life in the tech world. I don't have time to learn a
lot of new things now, so I'm trying to get by with what I do know, with the
plan to redo things later if I learn better ways of doing things.
: > If you were on "Other" page, for example, the background colour of the
: > "Other" cell was a different shade from the others. I created this by
: > altering the code on each page.
:
: > Now I'd like to have this different colour for the page name cell at
another
: > site using SSI for the nav bar.
:
: > even more fun, some of the page names are entry points to another
section of
: > the site. If I can make "Other" a different colour, for example, I'd
also
: > like to make pages in the "Other" folder have this same feature so that
: > readers know that they're in the "Other" section of the site.
:
: A simple technique to achieve both goals would be to grab the
: querystring and parse it; you can easily retrieve the folder part (the
: section) to make the desired changes in your page, and the file name
: part to update the corresponding menu item.

<useful script snipped>

: The function here just creates a specific scope, so that you can
: safely put the js code in a js include, for instance in your SSI -
: just update the id of the menu container, and maybe the extensions and
: additional querystrings in the regexp.

Thanks! After I posted my post, I came across another way to get the cells
the way you did them w/o using a table, but your way uses less coding.

However, a pop-up window isn't what I had in mind. I wouldn't want to use
one just to tell people what page they're on. Is there a way to make the
cell (or whatever it is) with the page name a different colour when it's the
name of the current page and the nav bar is an SSI file? Maybe there isn't,
but I thought I'd ask.

I appreciate your help.

Thanks again,
Lois

Jul 20 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

7
by: WindAndWaves | last post by:
Hi Gurus I am keen to make a search page on a website, but I have absolutely zero experience with PHP. I am going to hire an expert, but I thought that it may pay to try it a bit first myself...
0
by: Rary | last post by:
I am using XSL:FO to generate PDF report for my XML, generating it in tables, i want that tables should completely be at one place, if there is a page break , all the contents of the table should...
1
by: Joseph Ferris | last post by:
Hello, I am having an issue with page breaking that I hope someone will be able to help me with. Still a relative "newbie", and I thought this might be a good place to find some help. I have a...
3
by: NeoPhreak | last post by:
I am creating a menu for my site and I would like it so that when the onMouseOut even is triggered it will cause the cell of the table to fade out back to the normal color with a delay. Can...
11
by: VK | last post by:
Hi, I'm playing around with tables (TOM vs. DOM etc.) I cannot figure out an effective highlight mechanics for the cells: 1) No problems with: <td ...onMouseOver/Out background change> some...
31
by: Arthur Shapiro | last post by:
I'm the webmaster for a recreational organization. As part of one page of the site, I have an HTML "Calendar at a Glance" of the organization's events for the month. It's a simple table of a...
0
by: Nathan | last post by:
Hi, I seem to having a peculiar problem with the display of odd and even pages in XSL-FO. Here is a small background of the problem. My xsl stylesheet mentions my fo:layout-master-set as ...
0
by: tom | last post by:
Hi all, I'm having a bit of trouble getting my site to output a certain number of results per page. Any help on this would be greatly appriciated. Without this function my code outputs all...
3
Frinavale
by: Frinavale | last post by:
Hi there, I'm using JavaScript to highlight a row or column in a table. I have created a CSS class that changes the background colour to a light blue and I apply this class to the cells in the...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.