history.go
- Started
- Last post
- 16 Responses
- mikeim
is there a go to next script like the history script:
javascript:history.go(-1);
And do i have to name my files a certain way?
- n_m0
no. coz you haven't been there yet, there is nothing to request.
you could do something increadibly simple with javascript though. just name your files 1.html, 2.html, etc. then set up a variable called pagenumber, set this to 1. then create a function that loads pagenumber.html, then adds one to pagenumber.
- mikeim0
cool. do you have any examples. i'm not really a coder but i can copt and paste me some mean code. this is for a photo gallery so that would be perfect.
- Bio0
*and if ya don't dance then yah... no friend of mine!*
- mikeim0
huh?
- unknown0
there is a history command that does the same as the forward and backward buttons... but I can't be arsed to find it for you... somelike History(-1)... something... bueller!
- n_m0
var pagenumber = 1;
function showNext(){
document.location.href = pagenumber + ".html";
pagenumber ++;
}<a href="javascript:showNext();">...
obviously, make sure the function is in an external file, and included, or pagenumber will remain as 1.
- ldww0
sweet script
but what happens when there is not another page to display, 404?
- unknown0
people die.
- n_m0
oh, i don't know. what about you got ten pages, then
if(pagenumber<10){
pagenumber++;
}else{
alert("there is nothing more to see. go out and get yourself a life.")
}for example
- unknown0
alert ("I can't get out of bed without asking someone how")
- mikeim0
n_m, thx!
i'll give that a try.
- unknown0
?... !
- Bio0
sorry, i was simply stating that if you dont dance, then you cant be my friend.
unfortunatly, that post was not meant for this thread, but i feel that in some ways, it is still pertinent to this thread as well.
RAH!
- unknown0
that's weird coz neither was mine... it was meant for the history one!
- Seph0
peppermint is yet to arrive.
I await with bad breath.
- mikeim0
n_m, i think i'm doing something wrong:
http://www.atdesignstudio.com/cl…it seems to be linking to itself. I just made 1.html and 2.html and i have to specify the var pagenumber to be 2 in 1.html for it to go there.