Sealyu

          --- 博客已遷移至: http://www.sealyu.com/blog

            BlogJava :: 首頁(yè) :: 新隨筆 :: 聯(lián)系 :: 聚合  :: 管理 ::
            618 隨筆 :: 87 文章 :: 225 評(píng)論 :: 0 Trackbacks

          Evaluates an expression after a specified number of milliseconds has elapsed.

          (在指定時(shí)間過后執(zhí)行指定的表達(dá)式)


          Syntax:

          iTimerID = window.setTimeout(vCode, iMilliSeconds [, sLanguage])

          Parameters

          vCode Required. Variant that specifies the function pointer or string that indicates the code to be executed when the specified interval has elapsed.
          iMilliSeconds Required. Integer that specifies the number of milliseconds.
          sLanguage Optional. String that specifies one of the following values:
          JScript Language is JScript.
          VBScript Language is VBScript.
          JavaScript Language is JavaScript.

          Return Value

          Integer. Returns an identifier that cancels the evaluation with the clearTimeout method.

          ==============================================================

          以上內(nèi)容摘自某本JScript教程(CHM格式,出處不詳,跟原作者說(shuō)聲Sorry)


          以下內(nèi)容沒抄任何人的,如果有雷同,估計(jì)不是你抄偶的就是巧合,嘿嘿.

          -------------------------------------------------------------------
          setTimeout( alert("3秒種過去了"), 3000);//調(diào)用一個(gè)函數(shù),允許帶常量參數(shù)
          -------------------------------------------------------------------
          <script language="Javascript">
          //by zuoyang

          var x = 1;
          var y = 2;
          var z = 3;

          var sum;

          function Plus(a, b)
          {
                    var z = 0;
                    var i = 0;
                    for (i = 0; i < arguments.length; i++)
                    {
                             z += arguments[i];
                    }
                    setTimeout( function() {alert(z);}, 6000); //可以帶變量參數(shù)的setTimeout調(diào)用形式
                    return z;
          }

          setTimeout( function(){ sum = Plus(x, y, z); }, 3000);/*除了可以帶變量參數(shù)還可以獲取返回值的setTimeout調(diào)用形式*/

          </script>

          setInterval()的用法和setTimeout()是一樣的:

          iTimerID = window.setInterval(vCode, iMilliSeconds [, sLanguage])

          不同的是setTimeout()是一次性作用,而setInterval()是每隔iMilliSeconds就執(zhí)行一次vCode.(Evaluates an expression each time a specified number of milliseconds has elapsed)

          posted on 2009-12-24 15:43 seal 閱讀(321) 評(píng)論(0)  編輯  收藏 所屬分類: Javascript
          主站蜘蛛池模板: 响水县| 历史| 西乡县| 樟树市| 天门市| 新河县| 修武县| 万全县| 柳江县| 基隆市| 太湖县| 建宁县| 郯城县| 临泉县| 丰顺县| 阳新县| 黑水县| 溆浦县| 卫辉市| 三门峡市| 虹口区| 化德县| 盐源县| 通渭县| 潍坊市| 汾阳市| 芦山县| 日照市| 呼图壁县| 葵青区| 阳东县| 武功县| 扶余县| 屏边| 荣成市| 高陵县| 永年县| 德清县| 徐闻县| 临武县| 廉江市|