Results 1 to 3 of 3

Thread: reloading a page at a specific time

  1. #1
    Join Date
    Jul 2007
    Posts
    27
    Thanks
    5
    Thanked 0 Times in 0 Posts

    Default reloading a page at a specific time

    I have a script that loads different login pages, depending on time range of day. How can I do that the page does automatically a reload at a certain time if the user has open the page previously ?


    Code:
    function goto(){ 
    
    var today=new Date(); 
    var hour=today.getHours(); 
    if((hour>0) && (hour<=12)){ .....

  2. #2
    Join Date
    Oct 2009
    Posts
    845
    Thanks
    14
    Thanked 189 Times in 188 Posts

  3. #3
    Join Date
    Dec 2008
    Location
    Portsmouth, UK
    Posts
    1,891
    Thanks
    2
    Thanked 441 Times in 435 Posts

    Default

    Code:
    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
        "http://www.w3.org/TR/html4/loose.dtd">
    
    <html>
    
    <head>
      <title></title>
    </head>
    
    <body>
    
    !! Uses Local time not server time !!
    <script type="text/javascript">
    <!--
    
    function RefreshTime(hm){
     if (hm){
      this.hm=hm.split(':');
     }
     var date=new Date();
     if (!zxcReadCookie('RefreshTime')&&this.hm[0]*1==date.getHours()&&this.hm[1]*1==date.getMinutes()){
      zxcCreateCookie('RefreshTime',true,.1);
      window.location=window.location;
     }
     setTimeout(function(){ RefreshTime(); },1000*60)
    }
    
    function zxcCreateCookie(nme,v,days){
     document.cookie=nme+'='+v+';expires='+(new Date(new Date().getTime()+days*86400000).toGMTString())+';path=/';
    }
    
    function zxcReadCookie(nme){
     nme+='=';
     var split = document.cookie.split(';');
     for(var z0=0;z0<split.length;z0++){
      var s=split[z0];
      while (s.charAt(0)==' ') s=s.substring(1,s.length);
      if (s.indexOf(nme)==0) return s.substring(nme.length,s.length);
     }
     return null;
    }
    
    RefreshTime('13:07');
    //-->
    </script></body>
    
    </html>
    Vic
    God Loves You and will never love you less.
    http://www.vicsjavascripts.org/Home.htm
    If my post has been useful please donate to http://www.operationsmile.org.uk/

Bookmarks

Posting Permissions

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