Results 1 to 6 of 6

Thread: Explain the Timing Events in JavaScript

  1. #1
    Join Date
    Aug 2009
    Posts
    155

    Explain the Timing Events in JavaScript

    I have an assignment in my JavaScript subject, where in I have to explain the JavaScript Timing Events. Also I have a question on Math objects in JavaScript which I am unable to understand. This I have in my second assignment. But first please help me to understand the Timing Events in JavaScript. Also provide some examples of Timing Events.

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

    JavaScript: setTimeout() Method

    Java script does supports Timing Events. Timing Events is to synchronize the Java script at time intervals. Thus we can execute are code using Java script even after a particular time period. One of the Timing Events method in Java script is the setTimeout() method. In case you want the code to be executed after some interval of time, then the setTimeout() is useful for this purpose.

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

    Math Objects of JScipt

    I can help you with two of the Math objects in JScript. I am also learning this topic now only. To perform tasks related to Mathematical data the user can use the Math object of JScript.
    max():
    To get the biggest number among the two specified numbers we use max().
    random():
    To get either 1 or 0 randomly we use the random().

  4. #4
    Join Date
    Feb 2008
    Posts
    1,852

    Timing Events to display Alert Box

    <html>
    <head>
    Code:
    <script type="text/javascript">
    function Alertb()
    {
    var ta=setTimeout("alert('11 seconds!')",11000);
    }
    </script>
    </head>
    
    <body>
    <form>
    <input type="button" value="Alert Box After 11 Seconds"
    onClick="Alertb()" />
    </form>
    </body>
    </html>
    The above code was written by me to develop a program that triggers an Alert Box after 11 seconds when the reader clicks on the Alert Box After 11 Seconds button.

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

    clearTimeout() of JavaScript

    The setTimeout() method is uses to set a time for the code to be executed after the defined time. And to cancel this action JavaScript supports a clearTimeout() method as well. This method will work to oppose the setTimeout(). Thus you can use this method to cancel any future timed event in JavaScript.

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

    Re: Explain the Timing Events in JavaScript

    The following code of HTML(Hyper Text Markup Language) is coded using JavaScript to start a counter when the button is clicked. The counter starts from 0:
    Code:
    <html>
    <head>
    <script type="text/javascript">
    var a=0
    var te
    function counter()
    {
    document.getElementById('TXT').value=a
    a=a+1
    te=setTimeout("counter()",1000)
    }
    </script>
    </head>
    
    <body>
    <form>
    <input type="button" value="Counter initialized" onClick="counter()">
    <input type="text" id="TXT">
    </form>
    </body>
    
    </html>

Similar Threads

  1. Nba2k12 Online Jumpshot Timing Vs The Regular Game Timing
    By UNCLEBREADMAN in forum Video Games
    Replies: 1
    Last Post: 26-12-2011, 03:37 PM
  2. Why we use Events in JavaScript?
    By Samarth in forum Software Development
    Replies: 5
    Last Post: 30-01-2010, 09:15 PM
  3. Timing programs in C
    By hariharan_00 in forum Software Development
    Replies: 5
    Last Post: 27-01-2010, 05:47 PM
  4. Javascript Keyboard Events In Iframe
    By Henryosa in forum Software Development
    Replies: 5
    Last Post: 25-01-2010, 02:04 PM
  5. What are the different Events in the Javascript?
    By Sheena_thakkar in forum Software Development
    Replies: 5
    Last Post: 18-12-2009, 08:07 AM

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,243,185.07324 seconds with 17 queries