NamePros
Welcome, Guest! Ready to make a name for yourself in the domain business? We welcome both the hobbyist and professional domainer to join the discussion as part of the NamePros community.

Click here to create your profile to start earning reputation for posting, and trader ratings for buying & selling in our free e-marketplace. Build your trader rating with each successful sale. Our system has tracked over 100,000 sales and counting!
FAQ & TOS Register Search Today's Posts Mark Forums Read

Go Back   NamePros.com > Website Development Discussion Forums > Programming
Reload this Page [resolved] $5 to paypal for help

Programming PHP, Perl, Ruby on Rails, AJAX, HTML, XHTML, CSS, JavaScript, MySQL and any other coding topics.

Advanced Search


Closed Thread
 
LinkBack Thread Tools
Old 03-04-2007, 06:12 AM THREAD STARTER               #1 (permalink)
NamePros Regular
 
Raz0rBlade_uk's Avatar
Join Date: Apr 2005
Location: United Kingdom
Posts: 630
Raz0rBlade_uk is on a distinguished road
 



$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.
????: NamePros.com http://www.namepros.com/programming/301006-resolved-5-to-paypal-for-help.html

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?
Raz0rBlade_uk is offline  
Old 03-04-2007, 02:43 PM   #2 (permalink)
NamePros Member
Join Date: Feb 2006
Location: Online
Posts: 118
Barts has a spectacular aura aboutBarts has a spectacular aura about
 



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!
__________________
A soul?... I've got not use for such frivolities.
Barts is offline  
Old 03-04-2007, 03:50 PM THREAD STARTER               #3 (permalink)
NamePros Regular
 
Raz0rBlade_uk's Avatar
Join Date: Apr 2005
Location: United Kingdom
Posts: 630
Raz0rBlade_uk is on a distinguished road
 



Originally Posted by BartMSX
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".
????: NamePros.com http://www.namepros.com/showthread.php?t=301006

Good luck!

Thanks a lot. I will try it out. If all is well then send me a PM with your paypal address
Raz0rBlade_uk is offline  
Old 03-04-2007, 03:55 PM   #4 (permalink)
NamePros Member
Join Date: Feb 2006
Location: Online
Posts: 118
Barts has a spectacular aura aboutBarts has a spectacular aura about
 



It's okay. It was fun to solve your problem. Just give me some rep
__________________
A soul?... I've got not use for such frivolities.
Barts is offline  
Old 03-04-2007, 04:13 PM THREAD STARTER               #5 (permalink)
NamePros Regular
 
Raz0rBlade_uk's Avatar
Join Date: Apr 2005
Location: United Kingdom
Posts: 630
Raz0rBlade_uk is on a distinguished road
 



Originally Posted by BartMSX
It's okay. It was fun to solve your problem. Just give me some rep
Oh Thanks man! How kind of you Rep++
Raz0rBlade_uk is offline  
Closed Thread


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools


Liquid Web Smart Servers  
All times are GMT -7. The time now is 05:10 AM.

Managed Web Hosting by Liquid Web
Domain name forum recommended by Domaining.com Powered by: vBulletin® Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.6.0 Ad Management plugin by RedTyger