Forum Home
Press F1
 
Thread ID: 46771 2004-07-05 03:15:00 Javascript help somebody (208) Press F1
Post ID Timestamp Content User
249929 2004-07-05 03:15:00 I'm creating a website with a collection of sequentially numbered pages (eg. from a01.htm thru a99.htm. I have created a base site with an i-frame in the centre which I want these pages to be opened in. I want to simply have a "next" and "previous" button on the main page which will allow a simple way to go to the next page in the series, or back a page.

I assume it'll need something javascript which involves variables and a filename+1 or something like that to make it work, but I have no idea on how to write this. Can anyone help me here?
somebody (208)
249930 2004-07-05 03:31:00 I think maybe you don't need javascript here, just standard HTML <a > tag links. hay u (5059)
249931 2004-07-05 04:12:00 I was thinking about my reply,

......and you would like the forward , back buttons in one frame, and the pages a01.htm to a99.htm in another frame, sorry I jumped the gun, you could then do with javascript, I might try it tonight, sorry I misunderstood you. of course if the forward, back buttons were in the same page life would be easy.
hay u (5059)
249932 2004-07-05 05:25:00 this does the same thing but with images will need too edited for your use
<head>
<script>
<!-- Hide from old browsers
myPict = new Array("../XXXXX/XXXXX/fox.jpg","../XXXXXX/XXXX/kiwi.jpg","../XXXX/XXXX/Lsprings.jpg","../XXXXX/XXX/paddle.jpg")
Pic = 0
t=myPict.length - 1

function chgSlide(direction)
{
if(document.images)
{
Pic = Pic + direction
if (Pic > t)
{
Pic = 0
}
if(Pic < 0 )
{
Pic = t
}
document.Activity.src = myPict[Pic]
}
}
//end hide -->
</script>
</head>

then
how to control it

&lt;&lt; Previous (javascript:chgSlide(-1)) Next &gt; &gt; (javascript:chgSlide(1))
beama (111)
249933 2004-07-05 05:32:00 hi hay u,

Thanks for the offer to help.

The forward/back buttons are on one page, containing an i-frame which is supposed to hold the content pages which will be named a01.htm thru a99.htm or whatever it end up to be (could 01.htm thru 99.htm, as it doesn't really matter to me).

Your help is much appreciated.
somebody (208)
249934 2004-07-05 05:32:00 sorry forgot to add try a search on google "free javascripts" that may reveal what you are looking for.

BTW I wrote that script ages ago. took me ages and yes a few books and that same google search helped me.
beama (111)
249935 2004-07-05 05:34:00 Thanks beama. My only concern is if I have a large number of pages, it would make the array quite large.

I'm wondering if there's a script which will simply take a filename, and add 1 to it for forward and subtract 1 for back. When it runs out of files it will just return an error message or something like that.
somebody (208)
249936 2004-07-06 07:38:00 bump somebody (208)
1