X-Received: by 10.66.102.68 with SMTP id fm4mr985393pab.27.1404289038511; Wed, 02 Jul 2014 01:17:18 -0700 (PDT) X-Received: by 10.140.86.21 with SMTP id o21mr7145qgd.24.1404289038464; Wed, 02 Jul 2014 01:17:18 -0700 (PDT) Path: csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!news.glorb.com!hn18no1761937igb.0!news-out.google.com!a8ni1qaq.1!nntp.google.com!w8no5160491qac.0!postnews.google.com!glegroupsg2000goo.googlegroups.com!not-for-mail Newsgroups: comp.lang.javascript Date: Wed, 2 Jul 2014 01:17:18 -0700 (PDT) Complaints-To: groups-abuse@google.com Injection-Info: glegroupsg2000goo.googlegroups.com; posting-host=89.3.107.183; posting-account=OI-fcgoAAAANkzgRSRS_Kb7wJzdeKYeV NNTP-Posting-Host: 89.3.107.183 User-Agent: G2/1.0 MIME-Version: 1.0 Message-ID: Subject: external javascript menu - highlight current page From: ba pal Injection-Date: Wed, 02 Jul 2014 08:17:18 +0000 Content-Type: text/plain; charset=ISO-8859-1 Xref: csiph.com comp.lang.javascript:25187 Hi, My website works using a javascript menu in an external file like the following The javascript JsMenuShowFile.js ---------------------------------- function JsMenuShow(){ document.write(''); document.write('
  • link3 page
  • '); document.write(''); return this; } if(document.URL.indexOf("link1_item.html")!=-1){ JsMenuShow(); } if(document.URL.indexOf("link2_item.html")!=-1){ JsMenuShow(); } And the html page to display these items ------------------------------------------ My primary query is how to highlight* the current page with this menu? My own answer to this would be to change JsMenuShow() into something different other than document.write. I know a little javascript mainly through other programming languages exposure. Has someone experienced a script similar to this? Would this create more overheads on the client computer as the menu is a recurring process for every page? My second query requires additional skills as it's about highlighting* the menu above (or the parent menu as it's known I think). But the menu file works using relative links so it's unlikely javascript can find the parent menu from nowhere. Illustration ... document.write('
  • link1 page
  • '); document.write('
  • link1 sub page
  • '); As it shows, the upper parent menu is within the
  • tags as link1_item.html and the child parent menu is link1_subItem1.html How to deal with the first query knowing that it's likely the second query will arise any time later? Thanks, Pascal