Edit:
Solved. It was a totally different sort of a problem. (The code was good.)
Im am completely noob to Javascript, and cannot debug this code of mine:
Code:
function pgupf(){
x=eval(document.getElementById('actpageno').value);
y=x-1;
z=x+1;
if (document.layers) {
document.layers["layer" + y].visibility='hide';
document.layers["layer" + x].visibility='show';
} else {
document.all["layer" + y].style.visibility='hidden';
document.all["layer" + x].style.visibility='visible';
}
document.getElementById('actpageno').value=z;
}
The code should "page up" between layers ("pages"), i.e.:
a) read out the "pageno" of the present layer (from form field "actpageno")
b) hide the present layer (its index equals to: the old value of actpageno - 1)
c) show the next layer (its index equals to the old value of pageno)
d) store the new value of "pageno" of the next layer in form field "actpageno"
(Layers are numbered from 0, whilst pagenos starts from 1, that is why the index of the present layer is actpageno - 1).
The code does all through a)-c), but d) is never done: the "actpageno" form field always shows "1" in firefox.
I am convinced that form field "actpageno" has the new value assigned (because the value of that field is retrieved by the code during hiding/showing the layers and that works as expected from page 1 to the last page 3), yet it is not shown in the field itself (using firefox as a browser). Why? Am I missing something?