Team:Cornell/templates/header
From 2012.igem.org
(Difference between revisions)
R.Lizarralde (Talk | contribs) |
R.Lizarralde (Talk | contribs) |
||
Line 24: | Line 24: | ||
var prev = document.getElementById("prev"); | var prev = document.getElementById("prev"); | ||
var next = document.getElementById("next"); | var next = document.getElementById("next"); | ||
+ | var needprev = false; | ||
+ | var neednext = false; | ||
for(var i=0;i<links.length;i++) { | for(var i=0;i<links.length;i++) { | ||
if(window.location.href.toString()==links[i]) { | if(window.location.href.toString()==links[i]) { | ||
- | |||
- | |||
alert("test"); | alert("test"); | ||
if(i==0) { | if(i==0) { | ||
- | + | neednext = true; | |
next.href=links[i+1]; | next.href=links[i+1]; | ||
} | } | ||
else if(i==links.length-1) { | else if(i==links.length-1) { | ||
- | + | needprev = true; | |
prev.href=links[i-1]; | prev.href=links[i-1]; | ||
} | } | ||
else { | else { | ||
+ | neednext = true; | ||
+ | needprev = true; | ||
prev.href=links[i-1]; | prev.href=links[i-1]; | ||
next.href=links[i+1]; | next.href=links[i+1]; | ||
} | } | ||
- | |||
} | } | ||
- | } | + | } |
- | + | if(needprev) prev.parentNode.style.display="block"; | |
- | + | if(neednext) next.parentNode.style.display="block"; | |
} | } | ||
</script> | </script> |
Revision as of 18:56, 19 June 2013