Yes. This is pretty easy. I also have suggestions. I would change the code you have currently posted to this:
Code:
var eventPages = [];
eventPages[0] = "EventPage01.asp";
eventPages[1] = "EventPage02.asp";
eventPages[2] = "EventPage03.asp";
var totalPages = eventPages.length;
I would save this in a .js file so that it may be accessed by all of your pages. Along with that code, here is some code to manipulate the previously listed code:
Code:
var curpn;
function nav(len) {
var num = (curpn+len);
if(num >= 0 && num <= totalPages) {
location.href = eventPages[num];
return 0;
}
else return 1;
}
The two put together would be:
Code:
var curpn;
var eventPages = [];
eventPages[0] = "EventPage01.asp";
eventPages[1] = "EventPage02.asp";
eventPages[2] = "EventPage03.asp";
var totalPages = eventPages.length;
function nav(len) {
var num = (curpn+len);
if(num >= 0 && num <= totalPages) {
location.href = eventPages[num];
return 0;
}
else return 1;
}
If you named the .js file navig.js, some example HTML code is this:
(EventPage02.asp)
Code:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html>
<head>
<title>[ Your Title Here ]</title>
<script type="text/javascript" src="navig.js"></script>
<script type="text/javascript">
curpn = 1; // this means that this page is EventPage02.asp
</script>
<style type="text/css">
</style>
</head>
<body>
This is an example of the navigators. They use JavaScript.
<br />
<a href="javascript:nav(-1)"><< Previous</a> | <a href="javascript:nav(1)">Next >></a>
</body>
</html>
Hope I helped. Ask 4 any questions.
-magicyte
Bookmarks