28 lines
940 B
JavaScript
28 lines
940 B
JavaScript
|
function extractPageName(hrefString)
|
||
|
{
|
||
|
var arr = hrefString.split('/');
|
||
|
return (arr.length<3) ? hrefString : arr[3].toLowerCase();
|
||
|
}
|
||
|
|
||
|
function setActiveMenu(arr, crtPage)
|
||
|
{
|
||
|
for (var i=0; i<arr.length; i++)
|
||
|
{
|
||
|
if(extractPageName(arr[i].href) == crtPage)
|
||
|
{
|
||
|
if (arr[i].parentNode.tagName != "DIV")
|
||
|
{
|
||
|
arr[i].className = "current";
|
||
|
arr[i].parentNode.className = "current";
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
|
||
|
function setPage()
|
||
|
{
|
||
|
hrefString = document.location.href ? document.location.href : document.location;
|
||
|
|
||
|
if (document.getElementById("divNavi")!=null)
|
||
|
setActiveMenu(document.getElementById("divNavi").getElementsByTagName("a"), extractPageName(hrefString));
|
||
|
}
|