Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Consistant Next Button

Status
Not open for further replies.

inqbus

Programmer
Apr 9, 2001
18
0
0
NZ
Hi all,

I found out reading and writing JavaScripts, are a little/lot different. So if there is no sample code, im lost (at the moment anyway).

I want a "Next" button that will take me to the next page in MyTour. I have a list of pages:
MyTour1.htm
MyTour2.htm
MyTour3.htm

Is it possible for the "Next" button in MyTour1.htm to goto MyTour2.htm and so on, without hard coding it.

Thanks for anything and everything...
nqbs

 
One option:
Use a global variable nextpage and set in your pages accordingly. Script will remain the same.
<html>
<head>
<title> 1 </title>
<script language=&quot;JavaScript&quot;>
nextpage = 2
function mynext(){
strNextpage = &quot;MyTour&quot; + nextpage + &quot;.htm&quot;;
document.location = strNextpage;
}
</script>
</head>
<body>
1 content<br>
<a href=&quot;javascript:mynext()&quot;>Next</a>
</body>
</html>

Another option will be if you use external js file with array of your pages and similar function.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top