I was given this Javascript file:
It is to make a breadcrumb menu on the bottom of the webpage.
How do I make this work? I'm kind of lost.
HTML Code:<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd"> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> <meta http-equiv="Content-Style-Type" content="text/css"> <title></title> <meta name="Generator" content="Cocoa HTML Writer"> <meta name="CocoaVersion" content="824.41"> <style type="text/css"> p.p1 {margin: 0.0px 0.0px 0.0px 0.0px; font: 12.0px Helvetica} </style> </head> <body> <p class="p1">function breadcrumbs(){</p> <p class="p1"><span class="Apple-converted-space"> </span>sURL = new String;</p> <p class="p1"><span class="Apple-converted-space"> </span>bits = new Object;</p> <p class="p1"><span class="Apple-converted-space"> </span>var x = 0;</p> <p class="p1"><span class="Apple-converted-space"> </span>var stop = 0;</p> <p class="p1"><span class="Apple-converted-space"> </span>var output = "<a href=\"/\">Home</a> > ";</p> <p class="p1"><span class="Apple-converted-space"> </span>sURL = location.href;</p> <p class="p1"><span class="Apple-converted-space"> </span>sURL = sURL.slice(8,sURL.length);</p> <p class="p1"><span class="Apple-converted-space"> </span>chunkStart = sURL.indexOf("/");</p> <p class="p1"><span class="Apple-converted-space"> </span>sURL = sURL.slice(chunkStart+1,sURL.length)</p> <p class="p1"><span class="Apple-converted-space"> </span>while(!stop){</p> <p class="p1"><span class="Apple-converted-space"> </span>chunkStart = sURL.indexOf("/");</p> <p class="p1"><span class="Apple-converted-space"> </span>if (chunkStart != -1){</p> <p class="p1"><span class="Apple-converted-space"> </span>bits[x] = sURL.slice(0,chunkStart)</p> <p class="p1"><span class="Apple-converted-space"> </span>sURL = sURL.slice(chunkStart+1,sURL.length);</p> <p class="p1"><span class="Apple-converted-space"> </span>}else{</p> <p class="p1"><span class="Apple-converted-space"> </span>stop = 1;</p> <p class="p1"><span class="Apple-converted-space"> </span>}</p> <p class="p1"><span class="Apple-converted-space"> </span>x++;</p> <p class="p1"><span class="Apple-converted-space"> </span>}</p> <p class="p1"><span class="Apple-converted-space"> </span>for(var i in bits){</p> <p class="p1"><span class="Apple-converted-space"> </span>output += "<a href=\"";</p> <p class="p1"><span class="Apple-converted-space"> </span>for(y=1;y<x-i;y++){</p> <p class="p1"><span class="Apple-converted-space"> </span>output += "../";</p> <p class="p1"><span class="Apple-converted-space"> </span>}</p> <p class="p1"><span class="Apple-converted-space"> </span>output += bits[i] + "/\">" + bits[i] + "</a> > ";</p> <p class="p1"><span class="Apple-converted-space"> </span>}</p> <p class="p1"><span class="Apple-converted-space"> </span>document.write(output + document.title);</p> <p class="p1">}</p> </body> </html>![]()
Below is a graphic of what the JavaScript is supposed to do. It's supposed to generate a breadcrumb menu.
Thanks





Bookmarks