EnCoCo Services

Tech Tips

Highlight Link(s) to current page

This function is useful to highlight a link e.g. in a navigation menu. For a sample see above links.

This function scans supplied document for links and compares them to the current url. If this function finds a match, it sets the color to the one supplied. With "decodeURL()" and "replace" URLs are normalized to function across different platforms.

<SCRIPT LANGUAGE="JavaScript">

      function HighlightLink(a,c) {

        u = decodeURI(a.URL);
        u = u.replace(/\\/g,"");
        u = u.replace(/\//g,"");

        t = a.all.tags("a");
        n = t.length;
        for (var i=0; i < n; ++i ) {
          x = t[i];
          h = decodeURI(x.href);
          h = h.replace(/\//g,"");
          if ( h == u ) {
            x.style.color=c;
          }
       	}
      }

</SCRIPT>

Now make sure above function is called like when the page has loaded. Yes, no # sign in color, that works better across different browsers.

<body ONLOAD="HighlightLink(document,'FF0000')" >


Image Investigator

Organize your photos with the help of our Image Investigator. Search your image library for similar images or retrieve images by painting a sample. Look if you have duplicates in your image library.

Copyright 2008 © EnCoCo - All Rights Reserved