Download the most recent version from the scripts page.
Script to set current page to a different style in site navigation. Allows the same navigation html to be used on every page. The script is placed at the end of the html, before the close </body> tag, and looks for links to the current page in all items with the appropriate class.
<ul id="nav">
navscript.js to add all the id's for the navigation containers on the site. The following example lists three nav id's, but there can be any number, including one:
// the id's of the elements containing the menu
mainDiv = new Array("nav","coolnav","funkynav");navscript.js before the close </body> tag on the html page:
<script type="text/JavaScript" src="navscript.js"></script> </body>
currpg. This class will be applied to a <span> element that will replace the link for the current page only:
/* this style will be applied to menu items that link to the current page */
.currpg {color: #FF9900;
background-color: #eee;
}<ul id="nav"> ... <li><span class="currpg">navscript</span> </li> ... </ul>
navscript_class.js. This script uses a class assigned to every navigation container instead of an id in step 1. The same class, or different classes can be used.
<LI><A href=about.html>ABOUT US</A> <UL id=aboutnav> <LI><A href=pack.html>THE NO BS MESSENGER PACK</A></LI> ... </UL> </LI>
index.html as default pagedefaultUrl in the file navscript.js to change the name of the default page. Otherwise the script will miss pages that can be called by just referring to the directory root (such as http://eightize.com), as the nav may refer to the actual file (ie http://eightize.com/index.php).copyright © 2006 eightize
This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.