Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Page 1 of 2 12 LastLast
Results 1 to 15 of 19
  1. #1
    New Coder
    Join Date
    Jun 2009
    Posts
    22
    Thanks
    4
    Thanked 0 Times in 0 Posts

    how do i script a rotating web page?

    Hi all!!

    I have a project that requires a monitor to display a url that changes every 30 seconds to another url/page (there are 6 pages total) then the cycle starts over.

    I have front page and was planning on using frames. I was going to use to frames a small bar on top and the larger frame below to display the urls that rotate.

    Can someone give me some guidance on how the script would work?


    Thanks
    M

  • #2
    Regular Coder
    Join Date
    May 2008
    Location
    Oxford, UK
    Posts
    422
    Thanks
    14
    Thanked 27 Times in 27 Posts
    is this for some kind of presentation-type thing that runs on a loop?

  • #3
    Regular Coder
    Join Date
    Mar 2008
    Posts
    235
    Thanks
    6
    Thanked 21 Times in 20 Posts
    Like this?

    Code:
    <body onload="setTimeout('location.href=\'anotherPage.html\'',5000);">
    That will pause for 5 seconds then send you to anotherPage.html
    Andrew Sharman
    Web designer, developer and programmer.

    If you found my post helpful, why not give thanks! :)

  • #4
    New Coder
    Join Date
    Jun 2009
    Posts
    22
    Thanks
    4
    Thanked 0 Times in 0 Posts
    It is a presentation. there are 5 pages (URLs) of live data - I want it to be able to rotate between the 5 pages - say every 30 seconds - Each page loads up, displays data, sets there a few seconds so you can see the data than changes to the next page.

    I used the
    "setTimeout('location.href=\'http://www.------.com\'',5000);"


    And it worked on changing to that page

    I tried to add a second line to see if it would go change again but it didnt.

  • #5
    New Coder
    Join Date
    Jun 2009
    Posts
    22
    Thanks
    4
    Thanked 0 Times in 0 Posts
    thanks so far for the info

  • #6
    Regular Coder
    Join Date
    Mar 2008
    Posts
    235
    Thanks
    6
    Thanked 21 Times in 20 Posts
    I assumed that if you had 5 pages like so:

    Code:
    firstPage.html
    secondPage.html
    thirdPage.html
    fourthPage.html
    fifthPage.html
    You would change the code respectively for each file like so:

    Code:
    firstPage.html :: <body onload="setTimeout('location.href=\'secondPage.html\'',5000);">
    secondPage.html :: <body onload="setTimeout('location.href=\'thirdPage.html\'',5000);">
    thirdPage.html :: <body onload="setTimeout('location.href=\'fourthPage.html\'',5000);">
    fourthPage.html :: <body onload="setTimeout('location.href=\'fifthPage.html\'',5000);">
    fifthPage.html :: <body onload="setTimeout('location.href=\'firstPage.html\'',5000);">
    Or am I misunderstanding?
    Andrew Sharman
    Web designer, developer and programmer.

    If you found my post helpful, why not give thanks! :)

  • #7
    New Coder
    Join Date
    Jun 2009
    Posts
    22
    Thanks
    4
    Thanked 0 Times in 0 Posts
    Thanks so far for the help

    well the other pages cant have code on then that redirects them, because when someone is actually on that page at the workstation checking/changing data i don’t want it to redirect on them while they edit that page.
    --
    The rotating screen sits out in a hall way and there is no user keyboard or mouse for this screen, it will rotate these certain pages for everyone to see. but you can log on and change things to these live urls.

    I was thinking that i would have to use frames and basically have code in the top frame that made the bottom frame change. It would display these urls in the bottom frame and the 1st frame would have the code on changing them. I was also thinking of making the 1st frame un-viewable or very small.

    Is this making sense?

    Thanks Again for the help so far.

    Last edited by zombiekittens; 06-08-2009 at 08:46 PM.

  • #8
    Supreme Master coder! _Aerospace_Eng_'s Avatar
    Join Date
    Dec 2004
    Location
    In a place far, far away...
    Posts
    19,291
    Thanks
    2
    Thanked 1,043 Times in 1,019 Posts
    The urls you are talking about would they be just other pages on the same site or would they be other sites all together? The example you used in post 4 won't work because of security issues.
    ||||If you are getting paid to do a job, don't ask for help on it!||||

  • #9
    New Coder
    Join Date
    Jun 2009
    Posts
    22
    Thanks
    4
    Thanked 0 Times in 0 Posts
    They would be on the same site. And hosted on the same computer.
    Last edited by zombiekittens; 06-08-2009 at 08:43 PM.

  • #10
    Supreme Master coder! _Aerospace_Eng_'s Avatar
    Join Date
    Dec 2004
    Location
    In a place far, far away...
    Posts
    19,291
    Thanks
    2
    Thanked 1,043 Times in 1,019 Posts
    Okay and what about scrollbars? Will the page not need them as the content won't be long enough?
    ||||If you are getting paid to do a job, don't ask for help on it!||||

  • #11
    New Coder
    Join Date
    Jun 2009
    Posts
    22
    Thanks
    4
    Thanked 0 Times in 0 Posts
    I can make the content fit the monitor resolution. so i dont think there will be scroll bars.

  • #12
    New Coder
    Join Date
    Jun 2009
    Posts
    22
    Thanks
    4
    Thanked 0 Times in 0 Posts
    What this is for is energy usage for a building. We have controls that use html to display its data. You can log into the system and see/edit information – and example would be to change the time lights go off in certain areas. So there are tons of pages you can access for information.
    We have some pages that we created that show all the data for areas and I want to display these pages in the hallway on a monitor.
    There are 5 pages total that I need to display. Each page needs show up on the screen – populate its data (this can take up to 10 seconds to retrieve all the data that displays) – stay ideal a for a few seconds (30?) then go to the next page.

    This code would work
    <body onload="setTimeout('location.href=\'firstPage.html\'',5000);">
    If I added it to the 5 pages.

    But it would interfere with anyone that is logged on the system and working with that page because they may need to look at the page for awhile. So I cant have it rotating on them.

    Worst case scenario is that we duplicate the 5 pages and rename them so that they are the ones that rotate. The dynamic data changed on the original pages would also change on the dups because both pages are getting the changed dynamic data from the same source (the controls). But I don’t want the customer to maintain 5 extra pages that are duplicated (it will get confusing) if they need to change a name of some static data such as a room name.

    So this is why I was thinking of the frames. Because the code in the 1st frame is just changing the display of the 2nd frame, which just so happens to be displaying one of the 5 pages I need displayed. so there is no extra code on the actual 5 pages that need to rotate.

    Any other ideas are greatly appreciated.

    Thanks
    M
    Last edited by zombiekittens; 06-08-2009 at 09:25 PM.

  • #13
    Supreme Master coder! _Aerospace_Eng_'s Avatar
    Join Date
    Dec 2004
    Location
    In a place far, far away...
    Posts
    19,291
    Thanks
    2
    Thanked 1,043 Times in 1,019 Posts
    This should work.
    Code:
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml">
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <title>Rotating Page</title>
    <style type="text/css">
    * {
    	margin:0;
    	padding:0;
    	border:0;
    }
    html, body, iframe {
    	height:100%;
    	width:100%;
    	overflow:hidden;
    }
    </style>
    <script type="text/javascript">
    var pages = new Array(); // this will hold your pages
    pages[0] = 'page1.html';
    pages[1] = 'page2.html';
    pages[2] = 'page3.html';
    pages[3] = 'page4.html';
    pages[4] = 'page5.html';
    pages[5] = 'page6.html';
    
    var time = 30; // set this to the time you want it to rotate in seconds
    
    // do not edit
    var i = 1;
    function setPage()
    {
    	if(i == pages.length)
    	{
    		i = 0;	
    	}
    	document.getElementById('holder').setAttribute('src',pages[i]);
    	i++;
    }
    setInterval("setPage()",time * 1000);
    // do not edit
    </script>
    </head>
    
    <body>
    <iframe id="holder" src="page1.html" frameborder="0" scrolling="no"></iframe>
    </body>
    </html>
    ||||If you are getting paid to do a job, don't ask for help on it!||||

  • #14
    New Coder
    Join Date
    Jun 2009
    Posts
    22
    Thanks
    4
    Thanked 0 Times in 0 Posts
    Oh man thanks so much!!!!
    This seems to be working perfectly

    Just what i wanted to know how to do

    M

  • #15
    New Coder
    Join Date
    Jun 2009
    Posts
    22
    Thanks
    4
    Thanked 0 Times in 0 Posts
    Okay I have a couple more ideas I am trying to figure out also.

    The rotating page code works perfectly. But I have a small obstacle I am trying to make easier.
    The energy controls require a login to access the system. So when I start the rotating page it goes to the login screen and if you enter your user name and password it goes back to the login screen again – over and over.

    If I log in the system with the user name and password from the actual login screen html, then open the rotating page html it will rotate the pages. We tried this on explorer 7 so it opened a new tab when I opened the rotating page.


    My guess is that sense it needs a system login, it realizes that your not logged in when you first start the rotating page html and redirects you to the login which bypasses the code of the rotating page. But if you have already have logged on and open the rotating page in the new tab it is using the cache of the login and password from the other tab.

    So is there a way to add code to make it login first then go to the rotating script?

    Also I am thinking adding script to the rotating page so that it goes to full screen (f11) so it hides the explorer bars.

    Thanks for helping me with this.

    M


    Also I am trying to make this seamless for the user.

    So I was think of making the computer start up at 7am and shutting off at 5pm – when the computer starts it automatically starts the rotating html .

    This is all the computer will do is display this rotating html, so no one will ever have to mess with it. It will just do its thing of starting up, displaying pages and shutting down each day with out any user involvement.

    Can I do this in Microsoft schedule tasks?

    I know this isn’t html coding but figured someone might know or at least point me in the right direction.
    Last edited by zombiekittens; 06-11-2009 at 02:10 PM. Reason: More Additional Info


  •  
    Page 1 of 2 12 LastLast

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •