Template:ETHZ Basel10

From 2010.igem.org

(Difference between revisions)
Line 2: Line 2:
<head>
<head>
<script type="text/javascript">
<script type="text/javascript">
-
window.onload = clearCurrentLink;
+
window.onload = setPage();
-
function clearCurrentLink(){
+
function getURL(hrefString)
 +
{
 +
var arr = hrefString.split('/');
 +
return  (arr.length<2) ? hrefString : arr[arr.length-2].toLowerCase() + arr[arr.length-1].toLowerCase();             
 +
}
-
var nav = document.getElementById("current");
+
function setCurrentLink(arr, crtPage)
-
var a = nav.getElementsByTagName("A");
+
{
-
for(var i=0;i<a.length;i++)
+
for (var i=0; i<arr.length; i++)
-
if(a[i].href == window.location.href.split("#")[0])
+
{
-
removeNode(a[i]);
+
if(getURL(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("ethzheader")!=null)
 +
setCurrentLink(document.getElementById("ethzheader").getElementsByTagName("a"), getURL(hrefString));
}
}
</script>
</script>

Revision as of 17:27, 27 July 2010