javascript timer

sponsored links

javascript timer

At javascritp, there are two special about timer function, they are:

1. Counting down the number of seconds timer : timename = setTimeout ( "function ();", delaytime);

2. Cycle timer: timename = setInterval ( "function ();", delaytime);

function () is a timer to trigger the implementation of the case are a function of, can be a function, it may also be some function, or javascript statements can also be a single use; separated; delaytime is the time interval in order to milliseconds.

Countdown timer is triggered after a specified time case, and the cycle timer is at repeated intervals when the arrival of trigger events, the difference is: the role of the former only once, while the latter the role of non-stop.

Countdown timer on the page is generally used only once required to trigger the situation, such as clicking a button at a certain time after the page Jump to the corresponding sites, can also be used to determine whether a viewer you are not on the site of the "old off ", if not, you can be at 5 or 10 seconds after the second Jump to the corresponding site, and then later told him in a certain place by a certain button to enter the Express.

Cycle timer generally required for the site on the results of their implementation from the complex, such as a javascript scroll bar or status bar can also be used to page the background of the picture with snow to express. These events from time to time required to run first.

Sometimes we also want to remove some of the timer to add at this time can be used clearTimeout (timename) to turn off the countdown timer, and use clearInterval (timename) to turn off the cycle timer.

Example 1:
setTimeout ( "confirm ('123456 ')", 1000);

<script language="JavaScript "type="text/javascript ">

function count () (
setTimeout ( "alert ( 'three seconds to the')", 3000)

</ Script>

Sometimes, we want to remove a timer, like the cycle timer is always kept the sport. Can be used clearTimeout (timename) to remove the setTimeout () timer, and setInterval () is used clearInterval (timename) to remove.

clearInterval (): terminate the timer. clearInterval (timer object name)
  • StumbleUpon
  • Digg
  • TwitThis
  • Mixx
  • Technorati
  • Facebook
  • NewsVine
  • Reddit
  • Google
  • LinkedIn
  • YahooMyWeb

Related Posts of javascript timer

  • Build flex + spring + blazeds + hibernate application

    Build flex + spring + blazeds + hibernate application First, set up the project blazeds 1, will blazeds.war extract to a directory, such as: myflex /; 2, set up java works were such as: MyFlex, in the orientation of selection create project from exis ...

  • Nan-Jing 5: When IBatis.Hibernate mixed affairs, pay attention to your SQL

    [Problem] Now, in the development of the so-called multi-storey JavaEE applications, data persistence layer is always essential, and "Automatic" of ORM - Hibernate, and "all-manual-type" of SqlMap - IBatis, equivalent data are Per ...

  • Hibernate connection pool configuration

    Hibernate connection pool configuration <! - Jdbc -> <property name="connection.driver_class"> oracle.jdbc.driver.OracleDriver </ property> <property name="connection.url"> jdbc: oracle: thin: @

  • hibernate to use the principle of

    The use of hibernate, implementation of data persistence. Has the following several processes. One configuration database connection information. Hibernate.config 2 configuration mapping. 3 use: the use of the process are the following steps: 3.1: Ge ...

  • hibernate generic generic DAO

    package org.lzpeng.dao; import; import java.util.List; import org.hibernate.Criteria; import org.hibernate.Query; import org.hibernate.criterion.Criterion; import org.springside.modules.orm.hibernate.Page; /** * * @version 2009-1-10 *

  • Struts2 + hibernate + spring problem user log in

    dao layer services layer action jsp <tr> <td align="center"> <b> user name: </ b> </ td> <td> <s: textfield name = "czyNumber" cssClass = "textstyle" theme = "simple" size = &q

  • Based on JDBC, JPA Annotation achieve simple CRUD Generic Dao

    The origin of ideas are pretty long history of reasons: [Use iBATIS history] The use of iBATIS has been a long time, the system is to use the CRUD template tool to generate the code, although there are tools to generate, but looked at a lot of CRUD the Sq

  • Hibernate secondary cache

    Hibernate cache: 2-bit cache, also known as process-level cache or SessionFactory level cache, secondary cache can be shared by all of the session Cache configuration and the use of: Will echcache.xml (the document code in hibernate package directory ...

  • Hibernate's lazy strategy

    hibernate Lazy strategy can be used in: <class> tag, it can be true / false Tags can <PROPERTY> values true / false type of necessary tools to enhance <set> <list> can tag values true / false / extra <many-to-one> <on ...

blog comments powered by Disqus
Recent Entries
Tag Cloud
Random Entries