Team:Vanderbilt/Buttons
From 2014.igem.org
(Difference between revisions)
(Created page with "function Buttons(lb, rb) { var leftButton = lb; var rightButton = rb; /**@description These functions cause the Buttons on the page to change the SubPage when clicked.**...") |
|||
Line 1: | Line 1: | ||
- | function Buttons(lb, rb) | + | function Buttons(lb, rb, p) |
{ | { | ||
var leftButton = lb; | var leftButton = lb; | ||
var rightButton = rb; | var rightButton = rb; | ||
+ | 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.**/ | ||
leftButton.onclick=function(){ | leftButton.onclick=function(){ | ||
- | + | page.turnPage(-1); | |
updateButtons(thisPage.getSubPageNum()); | updateButtons(thisPage.getSubPageNum()); | ||
}; | }; | ||
rightButton.onclick=function(){ | rightButton.onclick=function(){ | ||
- | + | page.turnPage(1); | |
updateButtons(thisPage.getSubPageNum()); | updateButtons(thisPage.getSubPageNum()); | ||
}; | }; |
Revision as of 20:52, 25 January 2015
function Buttons(lb, rb, p) {
var leftButton = lb; var rightButton = rb; 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(thisPage.getSubPageNum());
};
rightButton.onclick=function(){
page.turnPage(1); updateButtons(thisPage.getSubPageNum());
};
this.updateButtons function(subPageNum) {
document.getElementById("igem_header").innerHTML = "reached updateButtons"; if(subPageNum == 1) { leftButton.style.visibility = "hidden"; rightButton.style.visibility = "visible"; } else if(subPageNum == thisPage.getMaxSubPage()) { leftButton.style.visibility = "visible"; rightButton.style.visibility = "hidden"; } else { leftButton.style.visibility = "visible"; rightButton.style.visibility = "visible"; }
} }