Results 1 to 6 of 6

Thread: Timer In JavaScript programming

  1. #1
    Join Date
    May 2008
    Posts
    222

    Timer In JavaScript programming

    Hello sir,
    I am developing a small program in java script which is planned to add it with a large web development project.The project requires a timer in the project means whenever I need to put some object which will be load at particular point of time.The loading of the project should be completed according to the time left.

    Thanks and regards.
    Brunoz

  2. #2
    Join Date
    Apr 2008
    Posts
    1,948

    Timer In JavaScript programming

    The java script programming follows the rules of the java programming and it is implemented with the web pages.

    There are so many tools and function in java script programming which is used to control and manage the functionality for time events.

    This is some of the list of functions which is used to construct the timer control in java script are as follows -

    1- setTimeout()
    2- clearTimeout()
    3- setInterval()
    4- clearInterval()

  3. #3
    Join Date
    May 2008
    Posts
    2,012

    Example of Timer In JavaScript

    Example of Timer In JavaScript

    Timers are generally applied in web pages and can be easily setup with a function named setTimeout().This function can represent you a simple example of how to construct a simple example for timer control :

    Code:
    Head_time = setTimeout(expression, msec);
    Where Head_time will identify the current timeout function.
    expression which would be executed for a specified time.
    msec is the duration of execution in milliseconds.

  4. #4
    Join Date
    Apr 2008
    Posts
    2,005

    Timer In JavaScript programming

    Using timer control,we can create a sample program which shows the timer control with the help of button control in HTML.

    I am going to create a page which pop up an message after a specified time after selection of particular object.

    You need to add another section which will show some message after the selection.The message would be pop-up after an occurred event.The code to create the message would be as follows -

    Code:
    <script type="text/javascript">
    function rminder(msg1) 
    {
     var message = "This is a reminder after " + msg1 +" Secs";
     alert(messsage);
    }
    </script>

  5. #5
    Join Date
    May 2008
    Posts
    2,297

    Timer In JavaScript programming

    Now,we are ready to construct the example when we select a radio button and after a specified time interval,a message would be occurred -

    You have to take the above posted example by kelfro and put it in your page and ready to create 4 radio buttons and add the timer control as a parameters for radio button which will be in action when you goes to choose them-
    <Html>
    <body>
    <input type=radio name=rd1 value=no checked>Reminder none
    <input type=radio name=rd2 value=5000 OnClick="Head_time=setTimeout('remind(2)',2000)">After 2 Secs
    <input type=radio name=rd3 value=5000 OnClick="Head_time=setTimeout('remind(5)',5000)">After 5 Secs
    <input type=radio name=rd4 value=5000 OnClick="Head_time=setTimeout('remind(10)',10000)">After 10 Secs
    <body>
    <Html>


    The message would be appeared when you choose one of the button at a time.

  6. #6
    Join Date
    Oct 2005
    Posts
    2,393

    Adding countdown in JavaScript

    Adding countdown in JavaScript

    The countdown can be added with your page and that should be coded in the java script and save it with the .js extension.

    You need to add the script tag within the page of your HTML like -

    Code:
    <script type="text/javascript" src="count.js">
    </script>
    The count.jsp is the name of the file in which the code for count down is tagged and of you want to add the count down at particular place in the page then you can use this code to create.

    Code:
    <span id="cd"></span>

Similar Threads

  1. Add Timer in c#
    By JasonWung in forum Software Development
    Replies: 1
    Last Post: 18-04-2012, 06:21 PM
  2. Sharepoint (MOSS) timer jobs and the timer service
    By MahaGuru in forum Office Setup
    Replies: 2
    Last Post: 01-03-2011, 09:08 AM
  3. Socket programming: Is any new Programming Language?
    By Kushan in forum Software Development
    Replies: 3
    Last Post: 14-11-2009, 11:13 AM
  4. Replies: 3
    Last Post: 13-12-2008, 01:49 PM
  5. Shutdown Your PC With a Timer
    By Aadi in forum Guides & Tutorials
    Replies: 5
    Last Post: 11-10-2008, 06:15 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,727,135,502.51807 seconds with 17 queries