Results 1 to 6 of 6

Thread: Refresh with the help of countdown timer

  1. #1
    Join Date
    Apr 2010
    Posts
    88

    Refresh with the help of countdown timer

    Hi, I would like to develop a page (a kind of ticker), I, I'd like to see a script, with the browser, for example, after a minute, can automatically update the table!! I am trying to do lot of things but it is not happening. . So thought that you guys must be knowing about it. How can I do it? Please help me as soon as possible. Any sample of the coding that can be useful for me, would be grateful.

  2. #2
    Join Date
    Mar 2008
    Posts
    258

    Re: Refresh with the help of countdown timer

    The following script will definitely help you. Copy to clipboard (Internet Explorer only).
    Code:
     <span><span style="direction: ltr; text-align: left" class="google-src-text">
    $scheme = is_empty($_SERVER['HTTPS']) ?</span> $ Scheme = is_empty ($ _SERVER ['HTTPS'])?
    </span> <span><span style="direction: ltr; text-align: left" class="google-src-text">'
    http' : 'https';$server = $_SERVER['SERVER_NAME'];$path = $_SERVER['PHP_SELF'];
    $query = $_SERVER['QUERY_STRING'];$url = "$scheme://$server/$path?$query";header("Refresh: 60; URL=$url");
    </span> 'Http': 'https', $ server = $ _SERVER ['SERVER_NAME'], 
    $ path = $ _SERVER ['PHP_SELF'], $ query = $ _SERVER ['QUERY_STRING'], 
    $ url = scheme ": $ / / $ server / $ path? $ query "; header (" Refresh: 60; URL = $ url ");</span>

  3. #3
    Join Date
    Apr 2008
    Posts
    193

    Re: Refresh with the help of countdown timer

    The below script is also made for am Internet Explorer.
    Code:
     <span><span style="direction: ltr; text-align: left" class="google-src-text">
    <html><head><script type="text/JavaScript">
    var sec=60;function time_show(){sec=sec-1;document.getElementById('time_ad').innerHTML = sec;window.setTimeout("time_show()", 1000);}
    </script></head><body onload="javaScript: time_show()">
    <div id="time_ad"></div></body></html></span> <html> 
    <head> <script type="text/JavaScript"> var sec = 60; 
    time_show function () (sec = sec-1; document.getElementById ('time_ad'). innerHTML = sec; 
    window.setTimeout (" time_show () ", 1000 );}</ script> </ head> 
    <body onload="javaScript: time_show()"> <div id="time_ad"> </ div> 
    </ body> </ html></span>
    Script loads the first function, which then calls again after 1000 ms = 1s. to the variable load is counted down and is wrote in a div element ... clear?

  4. #4
    Join Date
    Apr 2010
    Posts
    88

    Re: Refresh with the help of countdown timer

    Java script is as desirable, but comes from PHP-script out error message:
    "Warning: Can not modify header information - headers already sent by (output started at C: \ Program Files \ xampp \ htdocs \ test.php: 7) in C: \ Program Files \ xampp \ htdocs \ test.php on line 22"
    Why am I getting this error message?? Otherwise: "$ scheme = is_empty ($ _SERVER ['HTTPS'])? 'Http': 'https'," I have omitted, because the browser the following error message "Fatal error: Call to undefined function is_empty () in C: \ Program Files \ xampp \ htdocs \ berufsbot \ test.php on line 18" displays.

  5. #5
    Join Date
    Dec 2008
    Posts
    183

    Re: Refresh with the help of countdown timer

    Instead of using only is_empty empty (unfortunately inconsistent created by the PHP programmers, perhaps, the last again or an alias). For header problem you find on Google or here in the forum and I am sure that you will get many solutions for this. Copy the script to clipboard of an Internet Explorer :
    Code:
     <span><span style="direction: ltr; text-align: 
    left" class="google-src-text">header("Location: http://google.com");
    </span> header ("Location http://google.com:");</span>
    Which must be spent in the HTML head, everything else is invalid HTML, and may well (at least in some browsers) problems.

  6. #6
    Join Date
    Nov 2008
    Posts
    996

    Re: Refresh with the help of countdown timer

    Yeah, even I think that “Mecurtis” is correct. I am providing sample of coding, so that it would be easy for you to understand.
    Code:
     java.text.DateFormat import;
     import java.text.SimpleDateFormat;
     import java.util.Date;
     import java.util.Timer;
     import java.util.TimerTask;
     import javax.swing.JFrame;
     import javax.swing.JLabel;
     public class Test extends JFrame (Timer
     / / Label to display the current time window
     private JLabel label = new JLabel ();
     Timer public Test () (
     / / Initialize window
     this.setSize (140.80);
     this.setDefaultCloseOperation (JFrame.EXIT_ON_CLOSE);
     this.add (label);
     )
     public void start timer () (
     / / Create the timer  
     Timer t = new Timer ("Timer Thread", true);
     / / Create the timer task as inner class
     TimerTask task = new TimerTask () (
     public void run () (
     / / This is always executed when the timer strikes:
     / / We write in the current time window
     DateFormat format = new SimpleDateFormat ("hh: mm: ss");
     setText (format.format (new Date ()));
     )
     );
     / / Start the timer immediately interval 1000ms
     t.schedule (task, 0, 1000); 
     )
     public void setText (String text) (
     / / Sets the text in the window and return it to the console also
     label.setText (text);
     System.out.println (text);
     this.validate ();
     )
     public static void main (String [] argv) (
     / / Main method: Creates the window and starts timer
     Test Test Timer timer = new Timer Test ();
     timerTest.setVisible (true);
     timerTest.startTimer ();
     )
     )

Similar Threads

  1. Replies: 3
    Last Post: 02-07-2012, 04:08 PM
  2. How to create countdown timer in Excel
    By Rao's in forum Windows Software
    Replies: 1
    Last Post: 07-01-2012, 12:23 PM
  3. Sharepoint (MOSS) timer jobs and the timer service
    By MahaGuru in forum Office Setup
    Replies: 2
    Last Post: 01-03-2011, 09:08 AM
  4. Countdown timer
    By john83 in forum Software Development
    Replies: 4
    Last Post: 25-08-2010, 09:10 PM
  5. Flash countdown timer tutorial
    By Beans in forum Software Development
    Replies: 3
    Last Post: 11-08-2009, 05:43 PM

Tags for this Thread

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
  •  
Page generated in 1,714,792,995.85130 seconds with 17 queries