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 = | + | window.onload = setPage(); |
- | function | + | function getURL(hrefString) |
+ | { | ||
+ | var arr = hrefString.split('/'); | ||
+ | return (arr.length<2) ? hrefString : arr[arr.length-2].toLowerCase() + arr[arr.length-1].toLowerCase(); | ||
+ | } | ||
- | + | function setCurrentLink(arr, crtPage) | |
- | + | { | |
- | for(var i=0;i< | + | for (var i=0; i<arr.length; i++) |
- | if( | + | { |
- | + | 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