JavaScript Highlight Example
Zero
About
The script looks up a tag by ID (in this case "navigation"), iterates through all the links, and applies a class (in this case "highlight") to the link pointing to the current page. This page calls display.js which loads the script itself and then adds the magical function call addHighlight('navigation', 'highlight') to the window onload event.
How to Steal This
- You'll want to dowload your own copy of menuhighlight.js and URL.js. Install them where you will.
- In menuhighlight.js, make the document.write of URL.js reflect the location of your copy (line 11, first line of logic).
- For each of your sites you'll want to make your own copy of display.js, once again changing the location of menuhighlight.js and making the addHighlight function apply the style of your choice to the ID of your choice.
- Attach your display.js to each page in your site.