Sealyu

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

            BlogJava :: 首頁 :: 新隨筆 :: 聯系 :: 聚合  :: 管理 ::
            618 隨筆 :: 87 文章 :: 225 評論 :: 0 Trackbacks
          <2009年12月>
          293012345
          6789101112
          13141516171819
          20212223242526
          272829303112
          3456789

          常用鏈接

          留言簿(14)

          隨筆分類

          隨筆檔案

          友情鏈接

          搜索

          積分與排名

          最新評論

          閱讀排行榜

          評論排行榜

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

          (在指定時間過后執行指定的表達式)


          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.

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

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


          以下內容沒抄任何人的,如果有雷同,估計不是你抄偶的就是巧合,嘿嘿.

          -------------------------------------------------------------------
          setTimeout( alert("3秒種過去了"), 3000);//調用一個函數,允許帶常量參數
          -------------------------------------------------------------------
          <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); //可以帶變量參數的setTimeout調用形式
                    return z;
          }

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

          </script>

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

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

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

          posted on 2009-12-24 15:43 seal 閱讀(319) 評論(0)  編輯  收藏 所屬分類: Javascript
          主站蜘蛛池模板: 兴海县| 延寿县| 巴东县| 平定县| 青河县| 鲁山县| 宜兰市| 胶南市| 峨眉山市| 舒兰市| 祁东县| 黑水县| 武隆县| 张家口市| 娄烦县| 济源市| 封丘县| 新田县| 长春市| 博客| 房山区| 麦盖提县| 眉山市| 仙居县| 深州市| 陇川县| 京山县| 石景山区| 昌黎县| 潼关县| 南丰县| 陇川县| 宁波市| 永昌县| 治县。| 砚山县| 娱乐| 阿拉善盟| 漳平市| 平顶山市| 腾冲县|