Dynadot โ€” .com Registration $8.99

[Resolved] $5 to PayPal for help

Spaceship Spaceship
Watch

Raz0rBlade_uk

Established Member
Impact
2
$5 to paypal for help

Hi there.

Basically I am developing a site and I need a little help with some fairly basic code.

The idea is that I have an Iframe on the page which displays an html page that is based in a directory on the ftp. On the main page I would like to have a link which once clicked cycles through the pages which are based in the folder with a number of .htm files.

For example, you load up the site and the html file titled 10.html is displayed in the Iframe. You click the link (this link is not in the Iframe) and it loads up the next page in descending order, 9.html. You click again and it then loads up 8.html into the Iframe. I would like it to cycle through the files and then loop back to the start again.

Does anyone have any idea of how to do this? Is it actually possible?
 
0
•••
The views expressed on this page by users and staff are their own, not those of NamePros.
.US domains.US domains
Here ya go bro:

Code:
<html>
<head>
<script type='text/javascript'>
	var maxNum = 10;

	function loadNextLink(currentNum) {
		if (currentNum==0) {
			currentNum=maxNum;
		}
		document.getElementById('myIframe').src = "document" + currentNum + ".html";
		document.getElementById('myLinkToNextPage').href="javascript:loadNextLink(" + eval(currentNum - 1) +");";
	}
</script>
</head>
<body onload="loadNextLink(maxNum);">
<a href="javascript:void(0);" id="myLinkToNextPage">Click to load next page</a>
<iframe id="myIframe" width="400" height="200"/>
</body>
</html>

Just change the global var "maxNum" to whatever the maximum number of pages you have. Once it reaches 0 it will start over (0 will not be shown). This example documents should be named "document??.html" where ?? can be any number between 1 and "maxNum".

Good luck!
 
0
•••
BartMSX said:
Here ya go bro:

Code:
<html>
<head>
<script type='text/javascript'>
	var maxNum = 10;

	function loadNextLink(currentNum) {
		if (currentNum==0) {
			currentNum=maxNum;
		}
		document.getElementById('myIframe').src = "document" + currentNum + ".html";
		document.getElementById('myLinkToNextPage').href="javascript:loadNextLink(" + eval(currentNum - 1) +");";
	}
</script>
</head>
<body onload="loadNextLink(maxNum);">
<a href="javascript:void(0);" id="myLinkToNextPage">Click to load next page</a>
<iframe id="myIframe" width="400" height="200"/>
</body>
</html>

Just change the global var "maxNum" to whatever the maximum number of pages you have. Once it reaches 0 it will start over (0 will not be shown). This example documents should be named "document??.html" where ?? can be any number between 1 and "maxNum".

Good luck!


Thanks a lot. I will try it out. If all is well then send me a PM with your paypal address
 
0
•••
It's okay. It was fun to solve your problem. Just give me some rep ;)
 
1
•••
BartMSX said:
It's okay. It was fun to solve your problem. Just give me some rep ;)

Oh Thanks man! How kind of you :D Rep++
 
0
•••
Dynadot โ€” .com Registration $8.99Dynadot โ€” .com Registration $8.99
Unstoppable Domains
Domain Recover
DomainEasy โ€” Payment Flexibility
  • The sidebar remains visible by scrolling at a speed relative to the pageโ€™s height.
Back