Template:Template HD

From 2009.igem.org

(Difference between revisions)
m
Line 408: Line 408:
</style>
</style>
<script type="text/javascript">
<script type="text/javascript">
-
var anz = document.getElementsByTagName("a").length;
+
var url = window.location
 +
var myNavi, myNaviElement, myNaviLink;
-
for (i=0; i<anz; i++)
+
// get navi bar
-
{
+
myNavi = document.getElementById('navi');
-
    if (document.getElementsByTagName("a")[i].href == location.href)
+
 
-
    {
+
// main entries in navi menu
-
        document.getElementsByTagName("a")[i].style.backgroundColor = "red";
+
myNaviElement = myNavi.children[0].children[0]; // first li
-
                 document.getElementsByTagName("a")[i].style.color = "white";
+
 
-
    }
+
myNaviLink;
 +
for (i = 0; i < myNavi.children[0].children.length; i++) {
 +
        myNaviLink = myNaviElement.children[0]; // first a in li
 +
        if (myNaviLink.href == url.href) {
 +
                myNaviLink.style.color = 'red';
 +
                 // change some image based on id here...
 +
                /*
 +
                someImage = document.getElementById('someImage');
 +
                someImage.src = 'path/to/image';
 +
                */
 +
        }
 +
        myNaviElement = myNaviElement.nextElementSibling;
}
}

Revision as of 21:16, 6 October 2009