3 Replies - 20407 Views - Last Post: 18 March 2013 - 12:18 AM Rate Topic: -----

#1 virgilwilsonjr  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 4
  • Joined: 24-December 12

Changing Web Pages On A Timer

Posted 24 December 2012 - 05:01 PM

I have 10 different categories with data that I need to display on a rotation.

Web Page with Category A displays for 30 seconds then web page with category B for 30 seconds etc. I have the code to display each page but need it to rotate automatically.

Thanks
Is This A Good Question/Topic? 0
  • +

Replies To: Changing Web Pages On A Timer

#2 Craig328  Icon User is offline

  • I make this look good
  • member icon

Reputation: 1947
  • View blog
  • Posts: 3,488
  • Joined: 13-January 08

Re: Changing Web Pages On A Timer

Posted 26 December 2012 - 07:49 AM

Welcome to D.I.C virgilwilsonjr. I see that this is your first visit to our forums. As a general rule, here in the CF forum, we ask that you provide some detail to the questions you're having an issue with. Sometimes that requires code (although in your case, maybe not). Basically, we're here to help but not to do your work for you.

That said, there are a few ways you can "rotate automatically" every 30 seconds. Probably the best way, per your limited description, is to use a Javascript function that, once the page loads, starts a 30 second timer and that at the end of the 30 seconds, loads a new URL (one of the pages you want to cycle to). That approach can be made to work with an entire page or to load just a portion of a page via an Ajax call or via jQuery. In fact, I think jQuery has a timer function built and ready to go.

Anyway, even if you're a beginning CF dev, that level of Javascript ought to be within reach and there's lots of resources on the web (our own Javascript forum, for example) that should point you in the right direction.

Good luck!

This post has been edited by Craig328: 26 December 2012 - 07:49 AM

Was This Post Helpful? 2
  • +
  • -

#3 virgilwilsonjr  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 4
  • Joined: 24-December 12

Re: Changing Web Pages On A Timer

Posted 01 January 2013 - 11:38 PM

Yes thank you I found an example of a java script. I forgot CF is server based and what I wanted to do was a client side function. I have been away from web program since CF vs 5.
Was This Post Helpful? 0
  • +
  • -

#4 ColdfusionDevShop  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 7
  • Joined: 17-March 13

Re: Changing Web Pages On A Timer

Posted 18 March 2013 - 12:18 AM

I give some line of javascript code that uses timer.timer counter will be call on 100 MiliSec. timer starts on page_load and page will be rotated on every 30sec.
<script language="Javascript">

	function onTimer() 
	{	
	if ( typeof onTimer.counter == 'undefined' )	 
	{ 	
	onTimer.counter = 500;
		
    }
	else
	{
		
	 onTimer.counter = onTimer.counter-100;	

	  document.getElementById('Remaining').value= onTimer.counter;
	
		
	 if(onTimer.counter<=0)
	 	{
                 lnk="link_to_next_page";
                 window.location(lnk);
		 }
	 
	}  
	 setTimeout(onTimer, 100);
	}
	
	window.onload=onTimer;
	</script>


This post has been edited by Craig328: 19 March 2013 - 07:07 AM
Reason for edit:: Using code tags: easy for some, hard for others

Was This Post Helpful? 0
  • +
  • -

Page 1 of 1