[Javascript] Re: Dynamic breadcrumbs script

Harry Love hlove at u.washington.edu
Fri Aug 23 13:40:15 CDT 2002


-----Original Message-----
From: javascript-admin at LaTech.edu [mailto:javascript-admin at LaTech.edu]
On Behalf Of Cutter (javascript list)
Sent: Friday, August 23, 2002 7:59 AM
To: javascript at LaTech.edu
Subject: [Javascript] Re: Dynamic breadcrumbs script

Harry, 

I love this breadcrumbs script. Works great, and the annotation is very 
helpful (you should submit it to the annotated list, ask David for
details). 
I modified it slightly to attach the class wrapper directly to the
anchor 
tags, this helped in controlling my styles. For the final level link I
also 
use the document.title attribute instead of the system parsing out
"index", 
although I haven't yet figured a way to remove the folder name behind it
if 
it is the index file (seems redundant to link to the page you're on).
For 
your company name issue (bottom of the script), could the user define a 
variable in the head of their documents if they wish to use this
feature, 
then have the script check to see if the variable exists, and if so 
implement it? 

Cutter 
----------------------------

Cutter,
Thanks for the input.  And I'm glad it works for someone else!

I took your advice and updated the script:
1) All of the basic customization for the first and last segments of the
breadcrumb are handled at the top of the script now.  No more fishing
for options.  Obviously, if you want, you can go beyond the basics.
2) The displayed text for the first link in the chain will always be the
text you specify in the FirstLinkName variable.  You can call it
whatever you like and the href will always go to the top level of your
web site.
3) The displayed text for the last segment has three options.  You can
use:
	a) Document title
	b) File name
	c) Whatever text you specify

The default setting uses the document title.  Switching between the
three is very simple, as you will see in the script comments.  For ease
of updating pages (help the developer), and for consistency among pages
(help the user), I decided to set the variables in the script, rather
than forcing a designer/developer to customize every page with a
different setting.  For those pages that need a different setting,
simply paste the entire script into your <head> tag instead of linking
to it.  Or if you prefer, you can customize the script to handle the
nuances of your site.

Here's the link again:
http://healthlinks.washington.edu/scripts/dynacrumbs.js

Let me know if you see other simple ways of improving the script.

Best regards,
Harry




More information about the Javascript mailing list