欧美bbbwbbbw肥妇,免费乱码人妻系列日韩,一级黄片

javascript中巧用“閉包”實(shí)現(xiàn)程序的暫停執(zhí)行功能

 更新時(shí)間:2007年04月04日 00:00:00   作者:  
Author:月影 
Form:http://bbs.51js.com/thread-66361-1-1.html
<input type="button" value="繼續(xù)" onclick='st();'/>

<script>
/*基本原理*/
var st = (function(){
  alert(1);
  alert(2);

  return function()
  {
    alert(3);
    alert(4);
  }  
})();
</script>
<input type="button" value="繼續(xù)" onclick='st();'/>
<script>
/*函數(shù)*/
function test(x)
{
  alert(x++);
  alert(x++);
  return function()
  {
    alert(x++);
    alert(x++);
  }
}
var st = test(10);
</script>
<input type="button" value="繼續(xù)" onclick='st();'/>
<script>
/*函數(shù)嵌套*/
function a(x,y)
{
  var st2 = b(x+y);
  return function()
  {
    st2 = st2();
    alert(st2);
  }
}
function b(a)
{
  alert(a++);
  alert(a++);
  return function()
  {
    alert(a++);
    alert(a++);
    return a;
  }
}
var st = a(10,20);
</script>

相關(guān)文章

最新評(píng)論