Team:Vanderbilt/Buttons
From 2014.igem.org
(Difference between revisions)
Line 1: | Line 1: | ||
- | |||
- | |||
function Buttons(p) | function Buttons(p) | ||
{ | { | ||
Line 6: | Line 4: | ||
var rightButton = document.getElementById("right_button"); | var rightButton = document.getElementById("right_button"); | ||
var page = p; | var page = p; | ||
- | |||
- | |||
/**@description These functions cause the Buttons on the page to change the SubPage when clicked.**/ | /**@description These functions cause the Buttons on the page to change the SubPage when clicked.**/ | ||
Line 17: | Line 13: | ||
rightButton.onclick=function(){ | rightButton.onclick=function(){ | ||
- | |||
- | |||
page.turnPage(1); | page.turnPage(1); | ||
updateButtons(page.getSubPageNum()); | updateButtons(page.getSubPageNum()); | ||
Line 28: | Line 22: | ||
rightButton.style.visibility = "visible"; | rightButton.style.visibility = "visible"; | ||
} | } | ||
- | else if(subPageNum == | + | else if(subPageNum == page.getMaxSubPage()) { |
leftButton.style.visibility = "visible"; | leftButton.style.visibility = "visible"; | ||
rightButton.style.visibility = "hidden"; | rightButton.style.visibility = "hidden"; |
Revision as of 21:19, 25 January 2015
function Buttons(p) {
var leftButton = document.getElementById("left_button"); var rightButton = document.getElementById("right_button"); var page = p;
/**@description These functions cause the Buttons on the page to change the SubPage when clicked.**/
leftButton.onclick=function(){
page.turnPage(-1); updateButtons(page.getSubPageNum());
};
rightButton.onclick=function(){
page.turnPage(1); updateButtons(page.getSubPageNum());
};
this.updateButtons = function(subPageNum) {
if(subPageNum == 1) { leftButton.style.visibility = "hidden"; rightButton.style.visibility = "visible"; } else if(subPageNum == page.getMaxSubPage()) { leftButton.style.visibility = "visible"; rightButton.style.visibility = "hidden"; } else { leftButton.style.visibility = "visible"; rightButton.style.visibility = "visible"; }
}; }