SitePoint Sponsor

User Tag List

Results 1 to 3 of 3
  1. #1
    SitePoint Wizard Another Designer's Avatar
    Join Date
    May 2005
    Posts
    1,369
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)

    How do I implement this JavaScript?

    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 = "&lt;a href=\"/\"&gt;Home&lt;/a&gt;  &gt;  ";</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 += "&lt;a href=\"";</p>
    <p class="p1"><span class="Apple-converted-space">    </span>for(y=1;y&lt;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] + "/\"&gt;" + bits[i] + "&lt;/a&gt;  &gt;  ";</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
    Attached Images Attached Images

  2. #2
    SitePoint Wizard Another Designer's Avatar
    Join Date
    May 2005
    Posts
    1,369
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)
    Come to think of it, It has Applets. Java has Applets NOT JavaScript, right?
    Maybe my boss didn't know what he was sending me?
    Anyone?

  3. #3
    SitePoint Wizard Another Designer's Avatar
    Join Date
    May 2005
    Posts
    1,369
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)
    Anyone? anyone at all?


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •