1

In a previous question I was provided with a small script by sean-7777 Creating a selected tab in a HTML tabstrip. It works the way he wrote it, but there are 2 issues with it.

First, while it looks for the 'current' class in the TD, it only applies it to the A tag. Second, if I add 'current' to the A tag the script does not find it, but does find it if I add it to the TD tag.

In my CSS I had to apply the :hover class to both the TD (.td1:hover) and the A (.anchor:hover) in order to get the colors I wanted. The A tag overrides the TD when it comes to the text color and that is why I had to apply the hover css to both.

I can preselect the "selected tab" by including the current class to both the TD (class='td1 bold center smaller current') and the A (class='anchor current'), but the script does not remove it when I click another tab, and as I stated above, if I only add it to the A tag the script does not find it, and if I add it only to the TD the link text does not reflect the selected color.

If I click the pre-selected tab after clicking on another tab then the script will remove the hilite when I next click on a different tab. I have been trying different things, but my lack of knowledge of this version of JavaScript is making it impossible to get anything to work properly.

So my questions are:

  1. How do I get the preselected tab to de-select when I click another tab?
  2. How do I get the 'current' class to be added and removed from both the TD and the A tags?

Edit: I finally got the cascading thing figured out. Changes in the CSS below. The script still looks for the current class in the TD but only applies it to the link text in the A tag. The pre-selected tab still remains hilited on the link text, TD de-selected, when you click another link. I believe this is also the script, and still doesn't deselect entirely until after clicking on it a second time and then clicking a different tab.

// this script by sean-7777 on stackoverflow
// https://stackoverflow.com/users/14884338/sean-7777
// https://stackoverflow.com/questions/70724038/creating-a-selected-tab-in-a-html-tabstrip
// Get all the tabs
const tabs = document.querySelectorAll("td.td1");
// Store the previous selected tab so we know which one to remove the class from
let prevSelected;
// Give each tab code
for (const tab of tabs) {
  // Add a function to run when it is clicked
  tab.addEventListener("click", evt => {
    // Remove the current class from the last selected element
    // On first run, prevSelected is not defined, so we need to check
    if (prevSelected) prevSelected.classList.remove("current");
    // Update prevSelected
    prevSelected = evt.srcElement;
    // Add the current class
    evt.srcElement.classList.add("current");
  });
  // I added this line attempting to make the pre-selected TD get added on the initial execution
  // It was this, plus using the Web Developer Tools in Firefox that enabled me to see what was going on
  if (!prevSelected && tab.classList.contains('current')) prevSelected = tab;
}
table {
  margin-left: auto;
  margin-right: auto;
  border: none;
  border-spacing: 1px;
}

.bold {
  font-weight: 700;
}

.center {
  text-align: center;
}

.td1 {
  background-color: springgreen;
  font-family: Arial, sans-serif;
  white-space: nowrap;
  padding: 0 0 0.5pt 0;
  vertical-align: middle;
}

.td1:hover, .td1 .anchor:hover {
  background-color: lightyellow;
  color: orange;
}

.smaller {
  font-size: small;
}

.anchor {
  text-decoration: none;
  color: darkgreen;
}

.td1.current, .td1 .anchor.current
{
  background-color: aliceblue;
  color: deepskyblue;
}
<TABLE>
  <TR>
    <TD class='td1 bold center smaller current'>&nbsp;<a class='anchor current' href='Items/sheet001.htm' target='frSheet'>One-Handed Weapons</a>&nbsp;</TD>
    <TD class='td1 bold center smaller'>&nbsp;<a class='anchor' href='Items/sheet002.htm' target='frSheet'>Two-Handed Weapons</a>&nbsp;</TD>
    <TD class='td1 bold center smaller'>&nbsp;<a class='anchor' href='Items/sheet003.htm' target='frSheet'>Ranged Weapons</a>&nbsp;</TD>
    <TD class='td1 bold center smaller'>&nbsp;<a class='anchor' href='Items/sheet004.htm' target='frSheet'>Ammunition</a>&nbsp;</TD>
    <TD class='td1 bold center smaller'>&nbsp;<a class='anchor' href='Items/sheet005.htm' target='frSheet'>Shields & Armor</a>&nbsp;</TD>
    <TD class='td1 bold center smaller'>&nbsp;<a class='anchor' href='Items/sheet006.htm' target='frSheet'>Accessories</a>&nbsp;</TD>
    <TD class='td1 bold center smaller'>&nbsp;<a class='anchor' href='Items/sheet007.htm' target='frSheet'>Technicks & Magicks</a>&nbsp;</TD>
    <TD class='td1 bold center smaller'>&nbsp;<a class='anchor' href='Items/sheet008.htm' target='frSheet'>Augments</a>&nbsp;</TD>
    <TD class='td1 bold center smaller'>&nbsp;<a class='anchor' href='Items/sheet009.htm' target='frSheet'>Items</a>&nbsp;</TD>
    <TD class='td1 bold center smaller'>&nbsp;<a class='anchor' href='Items/sheet010.htm' target='frSheet'>The Bazaar</a>&nbsp;</TD>
    <TD class='td1 bold center smaller'>&nbsp;<a class='anchor' href='Items/sheet011.htm' target='frSheet'>Grimoires</a>&nbsp;</TD>
    <TD class='td1 bold center smaller'>&nbsp;<a class='anchor' href='Items/sheet012.htm' target='frSheet'>Bazaar Packages</a>&nbsp;</TD>
    <TD class='td1 bold center smaller'>&nbsp;<a class='anchor' href='Items/sheet013.htm' target='frSheet'>Shops</a>&nbsp;</TD>
    <TD class='td1 bold center smaller'>&nbsp;<a class='anchor' href='Items/sheet014.htm' target='frSheet'>License Board</a>&nbsp;</TD>
    <TD class='td1 bold center smaller'>&nbsp;<a class='anchor' href='Items/sheet015.htm' target='frSheet'>Lower Half</a>&nbsp;</TD>
    <TD class='td1 bold center smaller'>&nbsp;<a class='anchor' href='Items/sheet016.htm' target='frSheet'>Upper Half</a>&nbsp;</TD>
  </TR>
</TABLE>
WayneCa
  • 157
  • 8
  • if you're following up on a previous question, please remember to link to that. Or better yet, [copy the relevant details into this post, so it's a standalone post](/help/how-to-ask) in addition to linking. – Mike 'Pomax' Kamermans Feb 17 '22 at 18:24
  • 2
    You shouldn't need the class applied to both elements; just use the cascade. `td.current a { }` will target an `a` that is a descendant of a `td` which has the class `current`. – Heretic Monkey Feb 17 '22 at 18:30
  • @Mike 'Pomax' Kamermans I tried to edit this question and it said that you already edited it and my changes had to be more substantive in order to update it. ??? Also, the code I posted is all that's necessary to make it stand alone. – WayneCa Feb 17 '22 at 18:32
  • Kind of lost in all that verbose description is: What is the one goal/Result desired? What is the ONE challenge with it? – Mark Schultheiss Feb 17 '22 at 18:32
  • The challenge/goal is that the whole TD (including the anchor) has to be hilited with the selected tab colors along with the first tab being preselected and the script de-selecting it when another tab is clicked. It was stated in my questions. – WayneCa Feb 17 '22 at 18:35
  • @Mike thanks for editing the code and making it a run-able snippet. I corrected the comma after current. The snippet wasn't showing the selected text hilite. The hover change is displayed perfectly, and if you click a different tab you can see how only the link text is being hilited instead of the entire tab, as well as the first tab not being fully de-selected. The TD is de-selcted but the link text is still selected. – WayneCa Feb 17 '22 at 18:55
  • Please follow Heretic Monkey's advice. You can also make the code very simple by using [event delegation](https://stackoverflow.com/questions/1687296/what-is-dom-event-delegation). Aside from the class names, you shouldn't use a table to present a navbar. Use `nav` and `ul` list with `li`s to create the navigation block. – Teemu Feb 17 '22 at 18:56
  • I tried what I thought he was talking about but don't understand how to make .current be td.current when it isn't applied to every td all the time. As far as the nav and ul thing, I will have to study that. I am not familiar with it. – WayneCa Feb 17 '22 at 18:59
  • I have been trying the event delegation thing and all that happens is the TD stops being hilited and only the link text is hilited. I am more interested in getting what I already have that works for the most part fixed than to start mucking with changing things and breaking what does work. – WayneCa Feb 17 '22 at 19:08
  • 1
    Well, the suggested elements would be more semantic, the structure of the page would be more understandable for screen readers or other accessibility helpers. Even the structure would be much the same, table -> nav, tr -> ul and td -> li, a bit of CSS for the ul to show it like your table is currently shown, and that's all. – Teemu Feb 18 '22 at 08:48
  • Yes, I did find that out. In fact, not even using the li tags. The examples I found showed that they are not specifically required and it gave me the look I was after. I have not fully implemented the nav version of the page online yet as I have a few other pages that have the same idea but different tabs that I want to convert first. – WayneCa Feb 18 '22 at 19:55

2 Answers2

2

I've updated your code with the following changes:

  • I added evt.preventDefault() just for this demonstration, so that clicking on the anchor does not navigate to a non-existent page. Remove this when you copy it back to your own code.
  • I set prevSelected to the td element by assigning the evt Event's currentTarget property, which always refers to the element on which the event was bound (in this case, tab).
  • I changed the CSS selector for your final rule from .td1.current, .td1 .anchor.current to .td1.current, .td1.current .anchor. This simplifies the JavaScript, as we only need to apply the current class to the tab/td element, not to both the td and the a. As you can see when you run the code, the text is highlighted appropriately.

I'm assuming that the pages linked to (e.g., Items/sheet002.htm) have their corresponding HTML updated to have the correct classes applied? If not you'll need to add some code to check the current URL against the href of the anchor and update the corresponding tab's classList to add the current class. Should be as simple as updating that final if to be something like:

  if (!prevSelected && location.href.includes(tab.querySelector('a').pathname)) {
    prevSelected = tab;
    tab.classList.add("current"); // this won't add it twice if it's already there.
  }

// this script by sean-7777 on stackoverflow
// https://stackoverflow.com/users/14884338/sean-7777
// https://stackoverflow.com/questions/70724038/creating-a-selected-tab-in-a-html-tabstrip
// Get all the tabs
const tabs = document.querySelectorAll("td.td1");
// Store the previous selected tab so we know which one to remove the class from
let prevSelected;
// Give each tab code
for (const tab of tabs) {
  // Add a function to run when it is clicked
  tab.addEventListener("click", evt => {
    // NOTE: The following line prevents the anchor from navigating to the 
    // href as expected. This is so that you can see the classes getting 
    // applied. Otherwise the snippet would be navigated to a non-existent
    // page. 
    evt.preventDefault();
    // Remove the current class from the last selected element
    // On first run, prevSelected is not defined, so we need to check
    if (prevSelected) prevSelected.classList.remove("current");
    // Update prevSelected to the td element, not the anchor, no matter
    // which we clicked on
    prevSelected = evt.currentTarget;
    // Add the current class
    prevSelected.classList.add("current");
  });
  // I added this line attempting to make the pre-selected TD get added on the initial execution
  // It was this, plus using the Web Developer Tools in Firefox that enabled me to see what was going on
  if (!prevSelected && tab.classList.contains("current")) {
    prevSelected = tab;
  }
}
table {
  margin-left: auto;
  margin-right: auto;
  border: none;
  border-spacing: 1px;
}

.bold {
  font-weight: 700;
}

.center {
  text-align: center;
}

.td1 {
  background-color: springgreen;
  font-family: Arial, sans-serif;
  white-space: nowrap;
  padding: 0 0 0.5pt 0;
  vertical-align: middle;
}

.td1:hover,
.td1 .anchor:hover {
  background-color: lightyellow;
  color: orange;
}

.smaller {
  font-size: small;
}

.anchor {
  text-decoration: none;
  color: darkgreen;
}

.td1.current,
.td1.current .anchor {
  background-color: aliceblue;
  color: deepskyblue;
}
<TABLE>
  <TR>
    <TD class='td1 bold center smaller current'>&nbsp;<a class='anchor' href='Items/sheet001.htm' target='frSheet'>One-Handed Weapons</a>&nbsp;</TD>
    <TD class='td1 bold center smaller'>&nbsp;<a class='anchor' href='Items/sheet002.htm' target='frSheet'>Two-Handed Weapons</a>&nbsp;</TD>
    <TD class='td1 bold center smaller'>&nbsp;<a class='anchor' href='Items/sheet003.htm' target='frSheet'>Ranged Weapons</a>&nbsp;</TD>
    <TD class='td1 bold center smaller'>&nbsp;<a class='anchor' href='Items/sheet004.htm' target='frSheet'>Ammunition</a>&nbsp;</TD>
    <TD class='td1 bold center smaller'>&nbsp;<a class='anchor' href='Items/sheet005.htm' target='frSheet'>Shields & Armor</a>&nbsp;</TD>
    <TD class='td1 bold center smaller'>&nbsp;<a class='anchor' href='Items/sheet006.htm' target='frSheet'>Accessories</a>&nbsp;</TD>
    <TD class='td1 bold center smaller'>&nbsp;<a class='anchor' href='Items/sheet007.htm' target='frSheet'>Technicks & Magicks</a>&nbsp;</TD>
    <TD class='td1 bold center smaller'>&nbsp;<a class='anchor' href='Items/sheet008.htm' target='frSheet'>Augments</a>&nbsp;</TD>
    <TD class='td1 bold center smaller'>&nbsp;<a class='anchor' href='Items/sheet009.htm' target='frSheet'>Items</a>&nbsp;</TD>
    <TD class='td1 bold center smaller'>&nbsp;<a class='anchor' href='Items/sheet010.htm' target='frSheet'>The Bazaar</a>&nbsp;</TD>
    <TD class='td1 bold center smaller'>&nbsp;<a class='anchor' href='Items/sheet011.htm' target='frSheet'>Grimoires</a>&nbsp;</TD>
    <TD class='td1 bold center smaller'>&nbsp;<a class='anchor' href='Items/sheet012.htm' target='frSheet'>Bazaar Packages</a>&nbsp;</TD>
    <TD class='td1 bold center smaller'>&nbsp;<a class='anchor' href='Items/sheet013.htm' target='frSheet'>Shops</a>&nbsp;</TD>
    <TD class='td1 bold center smaller'>&nbsp;<a class='anchor' href='Items/sheet014.htm' target='frSheet'>License Board</a>&nbsp;</TD>
    <TD class='td1 bold center smaller'>&nbsp;<a class='anchor' href='Items/sheet015.htm' target='frSheet'>Lower Half</a>&nbsp;</TD>
    <TD class='td1 bold center smaller'>&nbsp;<a class='anchor' href='Items/sheet016.htm' target='frSheet'>Upper Half</a>&nbsp;</TD>
  </TR>
</TABLE>
Heretic Monkey
  • 11,687
  • 7
  • 53
  • 122
  • Thanks! This definitely corrected the issue. For what it's worth, I also looked into the nav tag and found that it wasn't that difficult to implement, but I really wanted to see this work. Thanks to you I have learned more about how the new version of JavaScript works. I have added your changes and credited you for the help. – WayneCa Feb 17 '22 at 20:57
2

I am going to suggest an alternative to classes - use data attributes in the script and the CSS - less toggle of classes, just set and unset values.

I also removed a lot of markup from the HTML for less "noise" and used classes as commented in the CSS.

NOW, this whole thing can use a <ul><li><a></li></ul> markup instead of a table - just have to add a bit of CSS to make the <li> not have bullets: re: I need an unordered list without any bullets I added this as a second example with flex and some borders to show stuff FWIW this is REALLY WIDE so you might change to flex-wrap: wrap;

ul {
  list-style-type: none;
}

Sample:

/* verbose version - commented out */
/*
const tabs = document.querySelectorAll(".td1");
for (const tab of tabs) {
  // Add a function to run when it is clicked
  tab.addEventListener("click", (event) => {
    let me = event.target; // the td1 element
     console.log(me.innerHTML);// the text or whatever is in .td1, the <a> in this case
     console.log(event.currentTarget.innerHTML); // the .anchor element since we put the margins on this, we can't really click outside of it
    const selectedItems = document.querySelectorAll(".td1[data-selected-item='current']");
    console.log(selectedItems.length, selectedItems[0].innerHTML);
    //https://developer.mozilla.org/en-US/docs/Web/API/HTMLElement/dataset
    for (const item of selectedItems) {
      console.log("Item:", item);
       const dataAttrMap = item.dataset;
       // could be: delete item.dataset.selectedItem;
      item.dataset.selectedItem = "not-current";
      console.log("Item:", item);
    }
    if ('selectedItem' in me.dataset === false) {
     console.log("got it");
      console.log(me.innerHTML);
      me.parentNode.dataset.selectedItem = "current";
    }
  });
}
*/
/* use me */
for (const tab of document.querySelectorAll(".td1")) {
  tab.addEventListener("click", (event) => {
    let me = event.target;
    for (const item of document.querySelectorAll(".td1[data-selected-item='current']")) {
      item.dataset.selectedItem = "not-current";
    }
    me.parentNode.dataset.selectedItem = "current";
  });
}
.outer-container {
  margin-left: auto;
  margin-right: auto;
  border: none;
  border-spacing: 1px;
  font-family: Arial, sans-serif; /*moved here */
}

.anchor {
  /* added class to remove &nbsp; noise from markup */
  margin-left: 1em;
  margin-right: 1em;
}


/* moved to container to reduce HTML noise */
.bold {
  font-weight: 700;
}

.center-all>.tabs-container>.td1,
.center {
  /* added center-all class to remove &nbsp; noise from markup */
  text-align: center;
}

.td1 {
  background-color: springgreen;
  white-space: nowrap;
  padding: 0 0 0.5pt 0;
  vertical-align: middle;
}

.td1:hover,
.td1 .anchor:hover {
  background-color: lightyellow;
  color: orange;
}

/* moved to container to reduce HTML noise */
.smaller {
  font-size: small;
}

.anchor {
  text-decoration: none;
  color: darkgreen;
}


/* swap out for data attribute values
.td1.current,
.td1 .anchor.current {
  background-color: aliceblue;
  color: deepskyblue;
}
*/

.td1[data-selected-item="current"] {
  background-color: aliceblue;
}

.td1[data-selected-item="current"]>.anchor {
  color: deepskyblue;
}

/* shows "prior selected" - not needed but just for "demo" of update vs delete*/
.td1[data-selected-item="not-current"]>.anchor {
  color: #880000;
}
<TABLE class="outer-container bold smaller center-all">
  <TR class="tabs-container">
    <TD class='td1' data-selected-item="current"><a class='anchor' href='Items/sheet001.htm' target='frSheet'>One-Handed Weapons</a></TD>
    <TD class='td1'><a class='anchor' href='Items/sheet002.htm' target='frSheet'>Two-Handed Weapons</a></TD>
    <TD class='td1'><a class='anchor' href='Items/sheet003.htm' target='frSheet'>Ranged Weapons</a></TD>
    <TD class='td1'><a class='anchor' href='Items/sheet004.htm' target='frSheet'>Ammunition</a></TD>
    <TD class='td1'><a class='anchor' href='Items/sheet005.htm' target='frSheet'>Shields & Armor</a></TD>
    <TD class='td1'><a class='anchor' href='Items/sheet006.htm' target='frSheet'>Accessories</a></TD>
    <TD class='td1'><a class='anchor' href='Items/sheet007.htm' target='frSheet'>Technicks & Magicks</a></TD>
    <TD class='td1'><a class='anchor' href='Items/sheet008.htm' target='frSheet'>Augments</a></TD>
    <TD class='td1'><a class='anchor' href='Items/sheet009.htm' target='frSheet'>Items</a></TD>
    <TD class='td1'><a class='anchor' href='Items/sheet010.htm' target='frSheet'>The Bazaar</a></TD>
    <TD class='td1'><a class='anchor' href='Items/sheet011.htm' target='frSheet'>Grimoires</a>&nbsp;</TD>
    <TD class='td1'><a class='anchor' href='Items/sheet012.htm' target='frSheet'>Bazaar Packages</a></TD>
    <TD class='td1'><a class='anchor' href='Items/sheet013.htm' target='frSheet'>Shops</a></TD>
    <TD class='td1'><a class='anchor' href='Items/sheet014.htm' target='frSheet'>License Board</a></TD>
    <TD class='td1'><a class='anchor' href='Items/sheet015.htm' target='frSheet'>Lower Half</a></TD>
    <TD class='td1'><a class='anchor' href='Items/sheet016.htm' target='frSheet'>Upper Half</a></TD>
  </TR>
</TABLE>

ul/li sample:

for (const tab of document.querySelectorAll(".td1")) {
  tab.addEventListener("click", (event) => {
    let me = event.target;
    for (const item of document.querySelectorAll(".td1[data-selected-item='current']")) {
      item.dataset.selectedItem = "not-current";
    }
    me.parentNode.dataset.selectedItem = "current";
  });
}
body {
  padding: 0;
  margin: 0;
}

.outer-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  width: 100%;
 
  line-height: 1.5em;
  font-family: Arial, sans-serif;
  border: solid 1px pink;
  margin: 0;
}

.tabs-container {
  display: flex;
  flex-wrap: wrap;


  width: 100%;
  column-gap: 0em;
  /* jamb together, no space */
  /* flex-wrap: none; */
  border: solid 1px lime;
  padding-left: 0;
  /* use to remove all the space around and in the box:
padding:0;
   margin:0;*/
  /*

  padding-right: 0;
  padding-top: 0.5em;
  padding-bottom: 0.5em;
  */
}

.tabs-container>* {}

ul {
  list-style-type: none;
}

.anchor {
  /* added class to remove &nbsp; noise from markup */
  /* removed with flex
 margin-left: 1em;
  margin-right: 1em;
  */
  padding-left: 1em;
  padding-right: 1em;
}

.bold {
  /* moved to container to reduce HTML noise */
  font-weight: 700;
}

.center-all .td1>* {
  /* added center-all class to remove &nbsp; noise from markup */
  text-align: center;
}

.td1 {
  background-color: springgreen;
  white-space: nowrap;
  border: solid 1px red;
}

.td1:hover,
.td1 .anchor:hover {
  background-color: lightyellow;
  color: orange;
}

.smaller {
  /* moved to container to reduce HTML noise */
  font-size: small;
}

.anchor {
  text-decoration: none;
  color: darkgreen;
}

.td1[data-selected-item="current"] {
  background-color: aliceblue;
}

.td1[data-selected-item="current"]:hover,
.td1[data-selected-item="current"]>.anchor:hover {
  background-color: #AAFFFF;
  color: #448888;
}

.td1[data-selected-item="current"]>.anchor {
  color: deepskyblue;
}

.td1[data-selected-item="not-current"]>.anchor {
  /* shows "prior selected" - not needed but just for "demo" of update vs delete*/
  /* color: #880000; commented out */
}
<div class="outer-container bold smaller ">
  <ul class="tabs-container center-all">
    <li class='td1' data-selected-item="current"><a class='anchor' href='Items/sheet001.htm' target='frSheet'>One-Handed Weapons</a></li>
    <li class='td1'><a class='anchor' href='Items/sheet002.htm' target='frSheet'>Two-Handed Weapons</a></li>
    <li class='td1'><a class='anchor' href='Items/sheet003.htm' target='frSheet'>Ranged Weapons</a></li>
    <li class='td1'><a class='anchor' href='Items/sheet004.htm' target='frSheet'>Ammunition</a></TD>
      <li class='td1'><a class='anchor' href='Items/sheet005.htm' target='frSheet'>Shields & Armor</a></li>
      <li class='td1'><a class='anchor' href='Items/sheet006.htm' target='frSheet'>Accessories</a></TD>
        <li class='td1'><a class='anchor' href='Items/sheet007.htm' target='frSheet'>Technicks & Magicks</a></TD>
          <li class='td1'><a class='anchor' href='Items/sheet008.htm' target='frSheet'>Augments</a></li>
          <li class='td1'><a class='anchor' href='Items/sheet009.htm' target='frSheet'>Items</a></li>
          <li class='td1'><a class='anchor' href='Items/sheet010.htm' target='frSheet'>The Bazaar</a></li>
          <li class='td1'><a class='anchor' href='Items/sheet011.htm' target='frSheet'>Grimoires</a>&nbsp;</li>
          <li class='td1'><a class='anchor' href='Items/sheet012.htm' target='frSheet'>Bazaar Packages</a></li>
          <li class='td1'><a class='anchor' href='Items/sheet013.htm' target='frSheet'>Shops</a></li>
          <li class='td1'><a class='anchor' href='Items/sheet014.htm' target='frSheet'>License Board</a></li>
          <li class='td1'><a class='anchor' href='Items/sheet015.htm' target='frSheet'>Lower Half</a></li>
          <li class='td1'><a class='anchor' href='Items/sheet016.htm' target='frSheet'>Upper Half</a></li>
  </ul>
</div>
Mark Schultheiss
  • 32,614
  • 12
  • 69
  • 100
  • This is definitely a solution, just in a different way. I will be studying this as I am planning to replace the table version with a nav version anyway. Now that I have more versions to choose from I can determine which one best suits my needs and the rest can be included on my web design site as examples of other ways to do it. Of course, proper credit will be applied to each version. It's too bad we can't have more than one accepted answer. I would include both yours and Heretic Monkey's answers as valid answers. – WayneCa Feb 19 '22 at 21:33
  • I almost forgot to say thanks in all the excitement. Thanks! – WayneCa Feb 19 '22 at 21:53